sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
9c2fe333183d1e0214fa8130676b4415757cd1b89366ddb080724c60e9d50fe3 | SAS | 423 | 21 | %macro pname;
%global pgmpathname;
%let pgmpathname=;
data _null_;
set sashelp.vextfl;
if (substr(fileref,1,3)='_LN' or substr
(fileref,1,3)='#LN' or substr(fileref,1,3)='SYS') and
index(upcase(xpath),'.SAS')>0 then do;
xpath1=prxchange('s/(\\)*(\/)*[^\\]+\.sas$//i',-1,trim(xpath));
call symput("pgmp... |
8a4199350d379c95005889c98d50bef30fbb79dd2a22b2af33597f490a0515d0 | SAS | 426 | 17 | %macro checkvarname(value);
%let position=%sysfunc(notname(value));
%put **** Invalid character in position: $position (0 means &value is okay);
%let valid=%sysfunc(nvalid(&value,v7));
%put
**** Can &value be a variable name (0=NO, 1=YES)? &valid;
%put;
%put;
%mend;
/*Demo:
%checkvarname(valid_name);
%checkvarna... |
39c1bb3f209fc43f746a54eb2d689dd3de7557fc8c80111f2f8df2115fafa7d1 | SAS | 428 | 22 | %macro dsd2matrix(dsd,row_var,col_var,data_var,matrix_out);
/*make sure to sort it*/
proc sort data=&dsd;
by &row_var &col_var &data_var;
run;
proc transpose data=&dsd out=&matrix_out(drop=_name_);
var &data_var;
by &row_var sorted;
id &col_var;
run;
%mend;
/*Demo codes:;
%dsd2matrix(dsd=All_drivers_mat... |
c62d4ae4b8943f7aaccf75ee3ce9d40480e45bcc2afff44a114bc70dcb836a85 | SAS | 429 | 14 | *options symbolgen mprint mlogic;
%global list;
%macro catx_macro_varlist(list,sep);
%let re=%sysfunc(prxparse(s/ /&sep/oi));
%let list=%sysfunc(cat("%sysfunc(prxchange(&re,-1,&list))"));
%put macro variable list now is updated as &list;
%put list can be used with cat or catx;
%syscall prxfree(re);
%mend;
/*... |
a6bd2f588d9ec43324cca30f77a979e98339accabf7ba686f73e54583870c9b9 | SAS | 436 | 20 | /* options mprint mlogic symbolgen xwait noxsync;*/
%macro chg_cwd(pwd,cmd);
%let go2path=%str(cd "&pwd");
data _null_;
call system(&go2path %str(&) &cmd);
run;
%mend;
/*
%pgmpathname;
%put pgmpathname=&pgmpathname;
%chg_cwd(pwd=c:/,cmd=ls);
%let execpath=%qsubstr(%sysget(sas_execfilepath),1,%length... |
34cffb458576debb852d8c27cb1ff03427ba7a69e22d442308a06aea6d6d7131 | SAS | 451 | 23 | %macro delmacrovars(macro_var_rgx);
data vars;
set sashelp.vmacro;
run;
data _null_;
set vars;
temp=lag(name);
if scope='GLOBAL' and
substr(name,1,3) ne 'SYS' and
temp ne name and
prxmatch("/¯o_var_rgx/",temp)
then
call execute('%symdel '||trim(left(name)... |
0f5d4698c02dd275e9ce177aa17871fba8cf9d2747e1613225922ec88c0a5fe7 | SAS | 455 | 20 | %Macro Make_Quote_Var_List_From_Dsd(indsd,var,sep);
%global quoted_var_list;
%let quoted_var_list=;
proc sql noprint;
select
unique(quote(compress(&var)))
into: quoted_var_list
separated by &sep
from &indsd;
quit;
%Mend;
/*
*Default separator=' ';
%Make_Quote_Var_List_From_Dsd(indsd=s... |
d22a49f848e092a75a527813ae071b6556be02a9e4fcd3b0c06032fa9192ab3b | SAS | 467 | 21 | %macro pgmname;
%global pgmpathname;
%let pgmpathname=;
data _null_;
set sashelp.vextfl;
if (substr(fileref,1,3)='_LN' or substr
(fileref,1,3)='#LN' or substr(fileref,1,3)='SYS') and
index(upcase(xpath),'.SAS')>0 then do;
xpath1=prxchange('s/(\\)*(\/)*[^\\]+\.sas$//i',-1,trim(xpath));
call ... |
31d56576c2507d5b5f8fc75ca090164de47a9106202d142bce9dd577554d5ad6 | SAS | 474 | 10 | %macro RmDups4PlinkBed(Plink_EXE,PlinkBed,OutBed);
*If there are dup SNPs with the same name, we can not use the command ids-only with suppress-first;
%let Exclude_dups=%str(&PLINK_EXE --allow-no-sex --list-duplicate-vars suppress-first --bfile &PlinkBed --out &OutBed);
%put &Exclude_dups;
X &Exclude_dups;
%let Exclu... |
6c54da531d4405d5995c668691d15b2f1e695595ac1bc3363ba9aaf8da2ee1ef | SAS | 476 | 20 | %Macro Make_NoQuote_Var_List_From_Dsd(indsd,var,sep);
%global noquote_var_list;
%let noquote_var_list=;
proc sql noprint;
select
unique(compress(&var))
into: noquote_var_list
separated by &sep
from &indsd;
quit;
%Mend;
/*
options mprint mlogic symbolgen macrogen;
%Make_NoQuote_Var_Lis... |
2ae6c9e6675a169a29a3df1e1aa457ba57db723e3f437b9049844c8ee8443c28 | SAS | 482 | 24 | %macro sas_dsd_exist(sasdsd,lib=work);
%local sas_dt_exist;
%let sas_dt_exist=0;
%if %sysfunc(prxmatch(/\./,&sasdsd)) %then %do;
%let lib=%scan(&sasdsd,1,.);
%let sasdsd=%scan(&sasdsd,2,.);
%end;
%let sas_dt_exist=%sysfunc(exist(&lib..&sasdsd));
&sas_dt_exist
%mend;
/*Demo codes:;
*This macro is a sas function to... |
acf7438c302cc9e514e6e6ffaa999cad8e88dbd9977d0514e221669ce0cd7a7d | SAS | 488 | 12 | %macro newdatasetname(proposalname);
%*Finds the first unused dataset named *datasetname*, adding a leading underscore and a numeric suffix as large as necessary to make it unique!;
%local i newdatasetname;
%let proposalname=%sysfunc(compress(&proposalname));
%let newdatasetname=_&proposalname;
... |
1c036b68b5488febdc506e9f6f284d7cbe1c751b79f846b62fea7233d45d27f4 | SAS | 492 | 24 | %macro get_all_sas_macros(
macro_dir=H:\F_Queens\360yunpan\SASCodesLibrary\SAS-Useful-Codes\Macros,
outdsd=files
);
%RecSearchFilesPureSAS(
root_path=¯o_dir,
filter=\.sas,
outdsd=files
);
data &outdsd;
set &outdsd;
macro=prxchange("s/.*Macros\/([^\/]+\.sas)/$1/i",-1,filefullname);
if prxmatch('/\//',mac... |
9681a5e410152f1e4db04af93347c62efc7f72bab1844b440ecf1c1a44fd0012 | SAS | 493 | 17 | %macro initcaps(title);
%local newtitle lastchar;
%let newtitle=;
%let lastchar=;
%do i=1 %to %length(&title);
%let char=%qsubstr(&title,&i,1);
%if (&lastchar=%str( ) or &i=1) %then %let char=%qupcase(&char);
%else %let char=%qlowcase(&char);
%let newtitle=&newtitle&char;
... |
125cd768c26e8b946c3b873ec8d3156c4ade523cc3a5e5c93d760e35885b69ad | SAS | 496 | 26 | %macro GetMinorAllele(dsdin,geno_var,dsdout);
ods select none;
ods output OneWayFreqs=GenoFreqs;
proc freq data=&dsdin;
table &geno_var;
run;
ods listing;
ods select all;
data GenoFreqs(keep=&geno_var Percent A1 A2);
set GenoFreqs;
A1=substr(&geno_var,1,1);
A2=substr(&geno_var,2,1);
if prxmatch('/([acgt... |
07499fe38678b350df3344876cdcfde2d9c0b416b96ad32db81965b120aaafce | SAS | 497 | 22 | %macro VarnamesInDsd(indsd,Rgx,match_or_not_match,outdsd,keepvarnum=0);
proc contents data=&indsd out=&outdsd(keep=name type VARNUM) noprint;
run;
proc sort data=&outdsd;by VARNUM;run;
data &outdsd;
set &outdsd;
%if &match_or_not_match %then %do;
if prxmatch("/&Rgx/i",name);
%end;
%else %do;
if not prxmatch("... |
4f73bbfa02fa7e0a2d79991684821ee6af8f496e51d7a25d9fd0ebe0835e1296 | SAS | 499 | 34 | %macro iscolallempty(dsd,colvar,outmacrovar);
%global &outmacrovar;
*Use the count function to get the number of non-empty elelments;
proc sql noprint;
select count(&colvar)
into: allmissing
from &dsd;
quit;
%if %sysevalf(&allmissing=0,boolean) %then %do;
%let &outmacrovar=1;
%end;
%else %do;
%let &outmacrovar=... |
dd72aa8d9793f7d86253ef28333f37bbebc739f2177cfeb57932eef82fdde42d | SAS | 500 | 16 | %macro File_Head(filename,n=10);
data _temp_;
length Line $32767.;
infile &filename dsd obs=&n length=varlen;
line=_infile_;
*SNP=prxchange("s/.*(rs\d+).*/$1/",-1,_infile_);
input line $varying32767. varlen;
run;
proc print data=_temp_;
%print_nicer;
run;
%mend;
/*usage demo:
*for spaces sep... |
b056d4961b09e8b05b6d0ff8275896c79127c0adc946577cfbb1856fc79080fa | SAS | 509 | 20 | %macro pgmpathname;
%global pgmpathname;
%let pgmpathname=;
data _null_;
set sashelp.vextfl;
if (substr(fileref,1,3)='_LN' or substr
(fileref,1,3)='#LN' or substr(fileref,1,3)='SYS') and
index(upcase(xpath),'.SAS')>0 then do;
xpath1=prxchange('s/(\\)*(\/)*[^\/\\]+\.sas$//i',-1,trim(xpath));
xp... |
7de50afc47777ca627b409ca5c880230f3e10562908a2a607714098be9134042 | SAS | 515 | 28 | %macro rows_in_sas_dsd(test_dsd);
%local dsid nlobs rc;
%let nlobs=0;
%let dsid=%sysfunc(open(&test_dsd,IS));
%if &dsid=0 %then
%put %sysfunc(sysmsg());
%let nlobs=%sysfunc(attrn(&dsid,NLOBS));
%let rc=%sysfunc(close(&dsid));
&nlobs
%if &nlobs gt 1 %then %do;
%put There are &nlobs in your dataset;
%e... |
c46420e9e185a0243f63f1116c0e59b99a73d45c54dced556946555033372722 | SAS | 519 | 24 | %macro vars4where_in(vars,sep);
%if &vars= %then %do;
%str( )
%end;
%else %do;
%if ("&sep"="") %then %do;
%let sep=%str( );
%end;
%let re=%sysfunc(prxparse(s/&sep/" "/oi));
%let var_list=("%sysfunc(prxchange(&re,-1,&vars))");
%syscall prxfree(re);
%put G... |
8d19a8a865b412faac171ad886f5443bbd7755cab81a9e5e81b5dd95b2cca41b | SAS | 520 | 20 | %macro randombetween(min, max);
%local rnd min max diff;
%let rnd=%sysfunc(ranuni(0));
%let diff=%sysfunc(floor(%sysevalf((1+&max-&min))*&rnd));
%let rnd=%sysevalf(&diff+&min);
&rnd
%mend;
/*Demo:
*Note: rand('norma') does not work when using the macro by other macro!;
*So the macro has been u... |
8d698e9aa75f70b0dcd4ae9e0090975ee083bbb275c3348f9a0da74251801d27 | SAS | 524 | 22 | %macro head(file=,dbms=tab,getnames=yes,datarow=2,nobs=15,out=_tmp_);
options obs=&nobs;
proc import out=&out
datafile="&file"
dbms=&dbms replace;
getnames=&getnames;
datarow=&datarow;
run;
proc print;run;
options obs=max;
%mend;
/*Demo:;
*Simpli... |
3586996f4174996d2927a6c46d35f45e7997cc369a489d522d1bfe8e20eff816 | SAS | 528 | 21 | %MACRO ExpandVarList(data=_LAST_, var=_ALL_);
%if %upcase(%superq(data)) = _LAST_
%then %let data = &SYSLAST;
%let rc = %sysfunc(dosubl(%str(
proc transpose data=&DATA(obs=0) out=ExpandVarList_temp;
var &VAR;
run;
proc sql noprint;
select _name_ into :temp_varnames separated by ' '
from ExpandVarList_temp
;
... |
d012f6f04c6e7d5bff0e425cfe83c02890044205162189e432bc58f7034dea73 | SAS | 533 | 26 | %macro axis_wall;
proc template ;
define style axis_wall;
parent=styles.journal2;
style graphwalls from graphwalls /
frameborder=off
linestyle=1
linethickness=2px
backgroundcolor=GraphColors("gwalls")
contrastcolor= black;
style graphaxislines from graphaxislines /
linestyle=1
lin... |
c6bf3b61d409609222d58122925940b6e2f9137707ca8385baffc18bcba80aa1 | SAS | 535 | 21 | %macro xls2txt(xlspath,getnames,txtoutpath);
proc import datafile="&xlspath" dbms=excel out=xlstmp replace;
getnames=&getnames;
run;
proc export data=xlstmp dbms=tab outfile="&txtoutpath" replace;
run;
%mend;
/*
%xls2txt(
xlspath=C:\Users\zcheng\Documents\PROPEL_SV_SNV_Testing\SNV Caller evaluation\Consens... |
84098570652d0efa5d5ffec6998d3711c002f78b82f2cff2f239d04ac89b37b1 | SAS | 553 | 33 | %macro Full_Pvalue(dsdin,dsdout);
proc contents data=&dsdin noprint out=P_tmp;
run;
proc sql noprint;
select count(*) into: Ptot
from P_tmp
where prxmatch('/PVALUE/',FORMAT);
select NAME into: v1-:%sysfunc(catx(%str(),v,&Ptot))
from P_tmp
where prxmatch('/PVALUE/',FORMAT);
%put &&v1;
%if &Ptot>0 %t... |
ead304a101e52466cf1d81b43e4d9c7cb6aaf3f88c3c88de15301f50487f83a0 | SAS | 554 | 30 | %macro print_head4dsd(dsdin,n=10);
%if &dsdin eq %then %do;
%let dsdin=_last_;
%put Use the last sas dataset &dsdin for printing;
%end;
%let dsid=%sysfunc(open(&dsdin,I));
%let nobs=%sysfunc(attrn(&dsid,nobs));
%let rc=%sysfunc(close(&dsid));
proc print data=&dsdin (obs=&n);
title "First &n obs ... |
c30ac8972dc9422e3cb704078a1e631ff10f63abe950f2b31aafc005c62492c9 | SAS | 556 | 23 | %macro RepRegx2ValueInDsd(dsdin,dsdout,RepRegx,Num_or_Char);
data &dsdout;
set &dsdin;
%if &Num_or_Char=1 %then %do;
array change _numeric_;
%end;
%else %do;
array change _character_;
%end;
do over change;
change=prxchange("&RepRegx",-1,change);
end;
run ;... |
0a947abe26d46d9d02473ae8e24bdccef52c48eb26dbf31d80db9579b2ef9435 | SAS | 567 | 22 | %macro estimate_alpha_beta(
/*Note: this macro will calcuate alpha and beta of beta distribution for data step;
It is important to know that mu=alpha/(alpha+beta) and var=alpha*beta/((alpha+beta)**2*(alpha+beta+1)),
as well as alpha=((1-mu)/var-1/mu)*mu**2 and beta=alpha*(1/mu-1);
*/
mu=, /*Mean of beta distributi... |
e5e22a620099c8e7873831ea4be6c46720939305d55da02882efb6c406df6c14 | SAS | 567 | 26 | *options mprint symbolgen mlogic;
%macro delete_empty_dsd(dsd_in);
%if (%sysfunc(count(&dsd_in,%str(.)))>0) %then %do;
%let lib=%scan(&dsd_in,1,'.');
%let dsd_in=%scan(&dsd_in,2,'.');
%end;
%else %do;
%let lib=work;
%end;
proc sql noprint;
select count(*)
into: obs_num
from &lib..&dsd_in;
%if (&obs_num=0) ... |
e740f142bcdfc9b68b3677f01b4d33507af22e7527a697973026a2cb7d36d8d2 | SAS | 587 | 16 | %macro obsnvars(ds= /*This macro will only print out message to indicate the number of records in a dataset!*/);
%global dset nvars nobs;
%let dset=&ds;
%let dsid = %sysfunc(open(&dset));
%if &dsid %then
%do;
%let nobs =%sysfunc(attrn(&dsid,NOBS));
%let nvars=%sysfunc(attrn(&d... |
879fa52b391d9311dacf81a3d0fcd4aa00706537be763a3c55485572ae57f744 | SAS | 592 | 22 | %macro Zip4Windows(Dir_or_files,out7z);
options nonotes;
data _null_;
/* infile 'c:\progra~1\"Easy 7-zip"\7z.exe a -r &out7z.7z F:\360yunpan\SASCodesLibrary\SAS-Useful-Codes\*' pipe ;*/
/*use dir /x to get fullname of Easy 7-zip under the dir c:\progra~1*/
infile "c:\progra~1\Easy7-~1\7z.exe a -r &out7z..7z &Di... |
2eb846a57843c5c7bab9cf7a67b35bdb00c02fb53f66fc1edd4a02afe43120c4 | SAS | 594 | 39 | %macro randomize_var(dsdin,var,rand_fun,dsdout);
proc sql noprint;
select count(*) into: totn
from &dsdin;
data &dsdout;
set &dsdin;
call streaminit(123);
xrnd=rand("&rand_fun",1,&totn);
ord=_n_;
proc sort data=&dsdout;by xrnd;
data &dsdout;
set &dsdout;
rnd_ord=_n_;
run;
proc sort data=&dsdout out=_tmp_;... |
53b10554db2bb5173f27e328662408fe500f45d6a4ae24f0ef33d0b5dcd4902f | SAS | 596 | 26 | %macro Rename_OldPrefix2NewPrefix(oldprefix, newprefix, num);
%let k=1;
%do %while(&k <= &num);
rename &oldprefix.&k = &newprefix.&k;
%let k = %eval(&k + 1);
%end;
%mend;
/*
data faminc;
input famid faminc1-faminc12 ;
cards;
1 3281 3413 3114 2500 2700 3500 3114 -999 3514 1282 2434 2818... |
54d9da23a550d9be2b3c0b057925cca3ac97d69c30b145087aafb96a99865afd | SAS | 598 | 22 | %macro print_nicer(
fontsize=12,
fontcol=dark,
column_font=Bold /*When requiring for monospaced font,
use Courier, or Consolas, among which Consolas is the best!*/
);
%str(
var _all_/style(column)=[fontsize=&fontsize.pt color=&fontcol fontfamily=&column_font]
style(header)=[fontsize=&fontsize.pt];
);
%me... |
781ee332ea6403cf533dd8fa4e82d57b2ff050ede353e15e809296f9190a7658 | SAS | 600 | 22 | %macro import_multi_xls(xlsdsd,getnames);
data _null_;
set &xlsdsd;
outpath=prxchange("s/[^\.]+$/txt/",-1,filefullname);
rc=dosubl('%xls2txt(xlspath='||filefullname||','||"getnames=&getnames,"||'txtoutpath='||outpath||')');
run;
%mend;
/*
%let path=C:\Users\zcheng\Documents\PROPEL_SV_SNV_Testing\SNVCallerev... |
75ca610d452691638e96407e60a44a497a5c1b29c669d84bb3482fb3f12606c9 | SAS | 605 | 27 | %macro RmATGC4PlinkBed(PlinkBed,NewPlinkBed,Plink_EXE=plink1.9.exe);
%Import_Space_Separated_File(abs_filename=&PlinkBed..bim,
firstobs=1,
getnames=NO,
outdsd=PLINK);
data Plink;
set Plink;
if (compress(catx("",trim(var5),trim(var6)))
in ("AT... |
690044f218b4d4c3a875d3ad27bd0134035b9879863578ee8628a1d5008e1c14 | SAS | 608 | 23 | /*proc print data=sashelp.class;
run;
options mprint;*/
/* Save variable names, labels and formats
from dataset DATA to dataset INFO */
%macro Get_All_Var_Info(indsd,outdsd);
%let dsd_name=%scan(&indsd,-1,'.');
%let dsd_lib=%scan(&indsd,-2,'.');
/*In case of no libname was provided*/
%if %eval(&dsd_lib=) %th... |
b8c972e843e2aab862028750659408a8d7ea2cdfb81c6220ecd87f97c74d4699 | SAS | 612 | 25 |
%macro trunc_dsdname(dsdname,st_substr=1); /*Make sas data name in the range of 1 to 32*/
/*dsdname can not contain more than 32 chracters;*/
/*Revised it accordingly;*/
%if &st_substr<%length(&dsdname) %then %do;
%let dsdname=%sysfunc(prxchange(s/\W+/_/,-1,&dsdname));
%let dsdname=%substr(&dsdname,&st_subst... |
4bf11cd058743f7f2347e0fd924c6e0d141f849c4f4030dad4f0bf105a6acfca | SAS | 621 | 37 | %macro iscolallmissing(dsd,colvar,outmacrovar);
%global &outmacrovar;
proc sql noprint;
select nmiss(&colvar)/count(&colvar)
into: allmissing
from &dsd;
quit;
%if %sysevalf(&allmissing=1,boolean) %then %do;
%let &outmacrovar=1;
%end;
%else %do;
%let &outmacrovar=0;
%end;
*This rescues the situat... |
6738e364cfabc8ab56adc5a46209125e4a94fa85934bc351b36a6ffe8d791b0b | SAS | 630 | 29 | %macro include_macros_from_github(
macros=importallmacros_ue /*supply multiple macro names separated by blank space*/
);
%let totmacros=%sysfunc(countc(¯os,%str( )));
%do macro_i=1 %to &totmacros;
filename out temp;
%let url_link=https://raw.githubusercontent.com/chengzhongshan/COVID19_GWAS_Analyzer/main/Macr... |
b791f8ece55a79d19327c4590f904c421c9c583f4cb70df07e3d13de00781fe1 | SAS | 635 | 25 | %macro get_num_or_char_vars4dsd(indsd,outdsd,numeric);
%if &numeric=0 %then %do;
%let var_type=char;
%end;
%else %do;
%let var_type=num;
%end;
%let dsd_name=%scan(&indsd,-1,'.');
%let dsd_lib=%scan(&indsd,-2,'.');
/*In case of no libname was provided*/
%if %eval(&dsd_lib=) %then %let dsd_lib=work;
proc... |
8a7a2299ec6b4fed5796fc53d94cb673dd8e557c5892999cebbdc73bcf81b8fc | SAS | 636 | 27 | %macro getnumorcharvars4dsd(indsd,outdsd,numeric);
%if &numeric=0 %then %do;
%let var_type=char;
%end;
%else %do;
%let var_type=num;
%end;
%let dsd_name=%scan(&indsd,-1,'.');
%let dsd_lib=%scan(&indsd,-2,'.');
/*In case of no libname was provided*/
%if %eval(&dsd_lib=) %then %let dsd_lib=work;
proc sql... |
6730a9748e6bccb142b341beaed0ccf936ba09ad7a349833f9ebf7b3e2410647 | SAS | 637 | 32 | %macro get_anno4macro(
macro_rgx=.,
anno_rgx=,
macro_dir=%sysfunc(pathname(HOME))/Macros/
);
%if %length(&anno_rgx)=0 %then %let anno_rgx=¯o_rgx;
proc import
datafile="¯o_dir/Available_SAS_Macros_and_its_annotations4STAR_PROTOCOL.csv"
dbms=csv out=x replace;
getnames=yes;
guessingrows=max;
run;
proc print dat... |
9310a8aeb2ead60ca25bd931032210af58664565cc74cd8964acf49df1054c64 | SAS | 638 | 26 | %macro Rename_Add_Prefix(oldvarlist, prefix);
%let k=1;
%let old = %scan(&oldvarlist, &k);
%do %while("&old" NE "");
rename &old = &prefix.&old;
%let k = %eval(&k + 1);
%let old = %scan(&oldvarlist, &k);
%end;
%mend;
/*
data faminc;
input famid faminc1-faminc12 ;
cards;
1 3281... |
9e418577b9bf26c2733213c8dd6b4600d1344b24b7fb38e1f60d0f85b6ddc570 | SAS | 638 | 26 | %macro Rename_Add_Suffix(oldvarlist, suffix);
%let k=1;
%let old = %scan(&oldvarlist, &k);
%do %while("&old" NE "");
rename &old = &old.&suffix;
%let k = %eval(&k + 1);
%let old = %scan(&oldvarlist, &k);
%end;
%mend;
/*
data faminc;
input famid faminc1-faminc12 ;
cards;
1 3281... |
e79e39189d89aa9ff6b2424dcd4560c792974b41767c5ef0945e0fcbbdb68a0c | SAS | 647 | 26 | %macro del_files_in_dsd(dsd,filevar,indir,match_rgx);
proc sql noprint;
select count(&filevar) into: n
from &dsd;
proc sql noprint;
select unique(&filevar) into:v1-:v%sysfunc(left(&n))
from &dsd
%if %eval("&match_rgx" ne "") %then %do;
where prxmatch("/&match_rgx/i",&filevar)
%end;
;
%do i=1 %to... |
d7f654395881375ee0e13c9be258ef6656cec85b59f9d9186103358ab9ac8533 | SAS | 649 | 26 | %macro get_num_or_char_vars4dsd(indsd,outdsd,numeric);
%if &numeric=0 %then %do;
%let var_type=char;
%end;
%else %do;
%let var_type=num;
%end;
%let dsd_name=%scan(&indsd,-1,'.');
%let dsd_lib=%scan(&indsd,-2,'.');
/*In case of no libname was provided*/
%if %eval(&dsd_lib=) %then %let dsd_lib=work;
proc... |
3682013c92c32623bdb2e9fb3b7e4129bdb5483d47c7521eeda08a3cbabed096 | SAS | 650 | 25 | %macro makebins(Range,bin_size,frmatname);
/*%let Range=2E5;*/
/*%let bin_size=1E3;*/
data for&frmatname;
drop i;
retain fmtname "&frmatname" type 'n';
do i = 0 to %sysfunc(ceil(2*&Range/&bin_size));*Can just use ceil function without %sysfunc;
binstart = round(-&Range + (i*&bin_size),.1);
binend = round(binsta... |
43abf559306c39a498bcfca13b297d170bc6ae60cd1cf2d8c28adf49b9c3fc54 | SAS | 656 | 31 | %macro check_col_orders(dsd,colorder_info_out,print_colobs=10);
proc contents data=&dsd out=&colorder_info_out noprint;
run;
data &colorder_info_out;
set &colorder_info_out;
keep name varnum type length format;
rename varnum=column_order;
run;
proc sort data=&colorder_info_out;
by column_order;
run;
data &co... |
51349ff8a856f099e1b844db3ccb664e03614f1d25636770f06f21b210472cd0 | SAS | 687 | 32 | %macro plink_qassoc_importer(
zipfile= ,/*file with appendix or .txt, .tgz, .gz, or .zip can be read by the macro*/
outdsd=assoc
);
%ImportFileHeadersFromZIP(
zip=&zipfile,
filename_rgx=.,
obs=max,
sasdsdout=&outdsd,
deleteZIP=0,
infile_command=%str(
firstobs=2 obs=max dsd truncover;
length snpid $20. ref $1. alt $3.;... |
4c1376de589f6e4c89f24814cf45de20e81df7cff68dc81c399a74e2e3a37ee9 | SAS | 689 | 27 | %macro SASToExcel(ImportLibrary=, ExportLocation=);
ods output members = _Members;
proc datasets lib = &ImportLibrary; run; quit;
proc sql;
select count(Name) into :NumOfDatasets from _Members;
select Name into :Dataset1-:Dataset%trim(%left(&NumOfDatasets)) from _Members;
quit;... |
4c10fc2de96cee9b19fbd4dfd20d91d1c26e3dff805cc8f42032a561e58d36f1 | SAS | 695 | 31 | %macro CD2CWD;
%let filefullpath=%sysget(sas_execfilepath);
*If the above failed in Linux, the following will rescue the procedure;
%if %length(&filefullpath)=0 %then %let filefullpath=&_sasprogramfile;
%let cwd=%qsubstr(
&filefullpath,
1,
%length(&filefullpath)-1-%length(%scan(&filefullpath,-1,"\/"))
);
... |
aa2f117652964b03f0839d18e6dbd974b845a0c12883f28066de8bcfe8b611f3 | SAS | 700 | 38 | %macro check_sas_fonts(font_rgx=.);
proc catalog catalog=sashelp.fonts entrytype=font;
contents out=work.fontlist(keep=name);
run;
data fontlist;
set fontlist;
if prxmatch("/&font_rgx/i",name);
run;
proc print data=work.fontlist;
run;
%mend;
/*Demo codes:;
%check_sas_fonts(font_rgx=SIMPLEX);
*the fol... |
ff81c39b3a2a792038f3f5f37ab127ef8bed60ada456b9ce1a597ee984f271d9 | SAS | 705 | 36 | %macro makebinnum(Range,bin_size,frmatname);
/*%let Range=2E5;*/
/*%let bin_size=1E3;*/
data for&frmatname;
retain fmtname "&frmatname" type 'n';
do i = 0 to %sysfunc(ceil(&Range/&bin_size));*Can just use ceil function without %sysfunc;
binstart = round(0 + (i*&bin_size),.1)+0.00000001;
*make the start will not ... |
dbc2897b44aaddc1d394fdd17d5542234b49388563f2bd7ba81e1fa359b98ead | SAS | 712 | 37 | %macro Sampling(indsd,n,nperm,dsdout,seed_value=2718);
options nonotes compress=yes;
%let i=1;
%do %while(&i<=&nperm);
proc surveyselect data=&indsd seed=&seed_value
method=srs n=&n out=&dsdout.s&i noprint;
run;
data &dsdout.s&i;
set &dsdout.s&i;
gp_perm=&i;
run;
%if &i=1 %then %do;
data &dsdout;
set ... |
92b92c23bf2fbd7a7c1b35624150bab52f4c0837a7f537e88777b779459d054e | SAS | 723 | 40 |
%macro histogram_in_svg(dsd,numvars,scale=1);
%let i=1;
%do %while (%scan(&numvars,&i,' ') ne );
%let numvar=%scan(&numvars,&i,' ');
options printerpath=(svg out) nobyline;
filename out "&numvar..histogram.svg";
ods listing close;
ods printer;
proc sgplot data=&dsd noborder nowall;
%if &scale=1 %then %do;
... |
6f5b29f9202dc1db366fdf96fe929c743d0eaf619a850a5683b3610e62f6e130 | SAS | 726 | 34 | %macro Table4matlab_matrix(dsdin,col4matrix_rowlabels,fixedmissingvalue,outdir);
%if "&fixedmissingvalue"="" %then %do;
%let fixedmissingvalue=-1000;
%end;
data tmp;
set &dsdin;
array X{*} _numeric_;
do i=1 to dim(X);
if X{i]=. then X{i}=&fixedmissingvalue;
end;
drop i;
run;
proc export data=tmp(keep=&... |
9e8da582323d1277a54ef9b81fb6c976d638412f688b75ef5f8d66acb15de65c | SAS | 735 | 25 | %macro TotVarsInDsd(/*This macro is able to count all, numeric, or character vars in a sas dataset*/
ds, /*This macro return total number of variables in a dsd*/
var_type=_all_ /*optional values including _all_, _numeric_, or _character_
for counting total number of all, numeric, or character vars*/
);
%l... |
50fee1216ba7ac26616d093ab44573cbaa289ad907b731f86e52be7c3accc73e | SAS | 747 | 38 | %macro dup_rows_by_grp(dsdin,grp_var,num_var4sort,desending_or_not,dsdout);
%if &desending_or_not %then %do;
proc sort data=&dsdin;
by &grp_var DESCENDING &num_var4sort;
run;
%end;
%else %do;
proc sort data=&dsdin;
by &grp_var &num_var4sort;
run;
%end;
data &dsdout;
retain ord grp 0;
set &dsdin;
if ... |
70286e8e47fa8f61e8b29dc3299012f3d3e1da35c9e679342a968780ada3c9f7 | SAS | 756 | 24 |
%macro delete_all_files_in_folder(folder);
filename filelist "&folder";
data _null_;
dir_id = dopen('filelist');
total_members = dnum(dir_id);
do i = 1 to total_members;
member_name = dread(dir_id,i);
file_id = mopen(dir_id,member_name,'... |
f506677b936f488163e2f1a4d99093475e234a7e90f9bf9e931081bf5b752fa9 | SAS | 765 | 28 | %macro vars_length_dsd(lib=work,dsd=,vars_rgx=,dsdout=,sum_vars_length=0,sum_vars_lengthoutvar=var_length_sum);
%KeepColMatchingRgx(indsd=&lib..&dsd,Rgx=&vars_rgx,outdsd=kept_dsd_tmp,insensitive=1);
proc contents data=kept_dsd_tmp noprint out=_var_length_Dsd(keep=name type length);
proc sort data=_var_length_Dsd;b... |
1efafd63ab80792b9a11d4ba4d49feb63f850600a92ff79a677880d631d6da72 | SAS | 769 | 22 |
%macro delete_all_txt_files_in_folder(folder);
filename filelist "&folder";
data _null_;
dir_id = dopen('filelist');
total_members = dnum(dir_id);
do i = 1 to total_members;
member_name = dread(dir_id,i);
if scan(lowcase(member_name),2,'.... |
e61597c38d426770962cabb2088dcb30e28e35c548fd6f7f78aa6a54466121c5 | SAS | 769 | 19 | %macro mk_dbquote_varlist(vars_list,sep,output_separator);
*Remove tailing spaces;
%let vars_list=%qsysfunc(prxchange(s/\s*$//,-1,&vars_list));
%if &output_separator eq "" %then %do;
&output_separator=%str( );*default separator is blank space;
%end;
%let new_sep=%str(%'&output_separator%');
%let re=%s... |
d55d737c77fce120a1be7cf6a55f501f203de50ce3e2f21f769409623f93f754 | SAS | 772 | 34 | *Note: this macro will get the smallest value that can be moded by the input denominator;
*If the macro get_value_or_fold=0, then the smallest fold is retured;
*otherwise, the smallest value that can be divided will be kept!;
%macro incr_value2div_by_num(
numerator=101,
denominator=2,
get_value_or_fold=0 /*default valu... |
ca5af29448116c3536c5b234e8834369f41a382aed4b0d08451fcbed3424b4e0 | SAS | 779 | 32 | %macro gsea_genesets2longfmt(file=,dsdout=,fileout=);
proc import datafile="&file" dbms=tab out=genes replace;
getnames=no;guessingrows=100000;
run;
proc sort data=genes;by var1;
proc transpose data=genes out=genes_tr;
var var:;
by var1;
run;
data &dsdout(rename=(col1=genesymbol var1=geneset) drop=_name_);
... |
4ce570ba020f856f5b0b79440b543418a7984054fe3ed6329e1e36ff1ec14d0f | SAS | 783 | 38 | %macro recursivesearchdirs(/*It will run the perl script RecursiveSearchDir.pl in terminal!*/
dirs=~/shared/Macros ~/SAS-Useful-codes,
filergx=.,
out=files
);
%let ndirs=%sysfunc(countc(&dirs,' '))+1;
%put your have supplied &ndirs dirs;
%put which are &dirs;
%do i=1 %to &ndirs;
%let dir=%scan(&dirs,&i,' ');
filename ... |
e093ac33fd9b4b9ae95d25d575e16e90a61110ec54f8982ceedab582b0eed32b | SAS | 786 | 29 | /* MACRO %GetVarLabel --> Calls %GetVarAttrib with specific parameter values
Version: 1.00
Author: Daniel Mastropietro
Created: 04-Sep-2015
Modified: 04-Sep-2015
DESCRIPTION:
Returns the label of a given variable in a dataset.
For more information see the macro %GetVarAttrib.
USAGE:
%GetVarLabel(da... |
0bbb1aa24da49cc45e4d0929da0436f514b7ff3f8cf400e90ea35690d4e045ae | SAS | 787 | 46 |
%macro SingleDsd2MergedDsd4DiffGrps(singledsd,num_grp_var,mergeddsd);
%SplitDsdIntoMultiDsdsByNumGrp(dsd=&singledsd,numgrpvar=&num_grp_var,newdsd_prefix=xxxxxx);
*delete the final dsd if it is there;
proc datasets lib=work nolist;
delete &mergeddsd;
run;
*create the final dsd by mergering ... |
b3d539977495a4ed83d9ada2846b7ccbe72ad2adf93b428308de30706cff6989 | SAS | 787 | 53 |
%macro dsd_x_multiple_dsd_y(dsd_x,prefix_dsd_x,dsd_y,dsd_out);
%Rename_Add_Prefix4All_Vars(indsd=&dsd_x,prefix=&prefix_dsd_x);
data &dsd_y;
set &dsd_y;
n=_n_;
run;
proc sql noprint;
select count(*) into: num from &dsd_y;
%do i=1 %to #
proc sql noprint;
create table xy&i as
select * from &dsd_... |
c421ac1bfa3206c77b90ac8efadb5d4ff7c41e33c4fbc2ecc4d1ba4a5ff12283 | SAS | 790 | 35 |
%macro Lambda_From_P(P_dsd,P_var,case_n,control_n,dsdout);
data tmp;
set &P_dsd(where=(&P_var>0));
chisq=cinv(1-&P_var,1);
run;
proc sql;
create table &dsdout as
select median(chisq)/cinv(0.5,1) as lamdba
%if (&case_n ne and &control_n ne) %then %do;
,
1+(median(chisq)/cinv(0.5,1)-1)*(1/&case_n+1/&control... |
e4c46173dcdf6911a527c183da68f4cc93c0377ce9af5a63eaef5bad9a91ea36 | SAS | 790 | 33 | %macro checkds(dsn);
%global dsd_exist;
%if %sysfunc(exist(&dsn)) %then %do;
%let dsd_exist=1;
proc print data = &dsn(obs=10);
run;
%end;
%else %do;
data _null_;
file print;
put #3 @10 "Data set &dsn. does not exist";
run;
%let dsd_exist=0;
%end;
%mend checkds;
... |
026d16863f640707384961bcd87286db9f5de19c53b85b4f4ab9cd953350fdd7 | SAS | 792 | 22 |
%macro delete_all_Appdx_files_in_folder(folder,Appendix);
filename filelist "&folder";
data _null_;
dir_id = dopen('filelist');
total_members = dnum(dir_id);
do i = 1 to total_members;
member_name = dread(dir_id,i);
if scan(lowcase(member... |
cb08d983df0e6cc6d24d06aad9b00db20e45d782c0bf3fbb329fd9e66f439146 | SAS | 796 | 34 | %macro exportds2gz(dsdin,outgz,outdir=/home/cheng.zhong.shan/data);
filename outgz zip "&outdir/&outgz..gz" gzip;
%let tmpfile=&outdir/&outgz..txt;
proc export data=&dsdin outfile="&tmpfile" dbms=tab replace;
run;
filename indsd "&tmpfile";
data _null_;
infile indsd;
file outgz;
input;
put _infile_;
run;
da... |
5682dce2bc7f5aec17703e0c03d8029c62f7810143ac7526f690e9c8eb6d3e5b | SAS | 798 | 33 | %macro ThreeVarTable4Counting(dsd,firstvar,secondvar,thirdvar);
/*
Make a table to count items in the following format:
firstvar would be the rownames of the table;
secondvar and thirdvar will be the 1st and 2nd column labels;
*/
%if "&thirdvar" ne "" %then %do;
proc report data=&dsd;
column &firstvar &secondva... |
e507564637999f7cab51066c31827c6df6df1c8f8027f46132b6c22e77f1465a | SAS | 800 | 29 | %macro VCF_Headers(dir=,filename=,dsdout=);
filename vcf "&dir/&filename";
*Get the total number of header lines;
*The last header line is used as header in proc import;
data &dsdout;
infile vcf lrecl=32767 length=linelen;
input colnames $varying32767.linelen;
n=_n_;
colnames=_infile_;
colnames=substr(coln... |
434309a8c4d7b580ede6fe7452a731ed90b1ef1e10f83c0fc723c6cf317f3479 | SAS | 806 | 33 | %macro rank4grps(grps,dsdout);
%let i=1;
data &dsdout;
length grps $300.;
%do %while (%scan(&grps,&i,%str( )) ne);
%let gval=%scan(&grps,&i,%str( ));
grps="&gval";num_grps=&i;
output;
%let i=%eval(&i+1);
%end;
run;
proc sort data=&dsdout;by grps;
data &dsdout;
set &dsdout;
char_ord=_n_;
run;
proc... |
4ff3502d83b7abf720d3bff16e7ff01f515473fceda5bb056db951e1bd9be30e | SAS | 810 | 26 | %macro pull_list(input_list,idx4pull,sep=%str( ));
%*both input_list and idx4pull should use the same separator;
%*this macro will generate a new list based on the idx4pull;
%*unlike another macro pull_list_by_idx, this macro will not genrate global variable;
%*containing the elements of the new list, instead which... |
9f1ff1e4f33c0dfaadd10c61895b7452b041a8798552836ec8bd8b28720f63e3 | SAS | 828 | 32 | *When the varlist is longer than 256 in the select process of proc sql, the macro would break;
*To solove the problem, use the alternative macro %roder_cols;
%Macro Order_Cols(indsd);
%let dsd_name=%scan(&indsd,-1,'.');
%let dsd_lib=%scan(&indsd,-2,'.');
proc sql noprint;
create table temp as
select varnum... |
a8b536d5dd61692bc3b40df3de49276bf96dc20cbdba6b9e6fadd147d3cc9be2 | SAS | 831 | 32 | %macro Rename_oldvarlist2newvarlist(oldvarlist, newvarlist);
%let k=1;
%let old = %scan(&oldvarlist, &k);
%let new = %scan(&newvarlist, &k);
%put Changed vars: &old => &new;
%do %while(("&old" NE "") & ("&new" NE ""));
rename &old = &new;
%put Changed vars: &old => &new;
%let k = %eval(... |
a2c587e3ee6cde3c9b213d97453eac33896abdebefa63b9e99f43ac20eb53f8f | SAS | 838 | 28 | %macro get_file_header4infile(filename,rownum4header,dlm,dsdout);
filename H "&filename";
data &dsdout;
length header $200.;
infile H obs=&rownum4header length=len firstobs=&rownum4header;
input;
n=_n_;
ndlm=countc(_infile_,&dlm);
do i=1 to ndlm;
header=scan(_infile_,i,&dlm);output;
e... |
9f479c69d2e795167118bfb4b1292cb9a9d83a3fd412f5638946a52e840ea278 | SAS | 844 | 26 | %macro nums_in_range(st,end,by,outmacrovar,quote=1);
%global &outmacrovar;
*This make the format include larger or negative numbers;
*Note: sometimes the negative numbers may be out of range of the format;
%let numlength=%eval(%length(&end)+1);
data range;
do i=&st to &end by &by;
out... |
10e81e4820d169aa47fcb40e4cc3f2d1a80e132fbcfeabe25654286206b18d75 | SAS | 856 | 26 |
/* VMACRO is a SASHELP view that contains information about currently */
/* defined macros. Create a data set from SASHELP.VMACRO to avoid a */
/* macro symbol table lock. */
%macro delvars;
data vars;
set sashelp.vmacro;
run;
data _null_;
set vars... |
9eb31200d334e66a4e70a9d0be6240faaad3b3d71266705882ee4664f52e1c73 | SAS | 856 | 58 | %macro scale4range(dsdin=,
ids=,
vars=,
factor4mult=1,
round_or_not=1,
outdsd=
);
%if &ids ne %then %do;
proc sort data=&dsdin out=&outdsd._srted;
by &ids;
run;
%end;
proc stdize data=&outdsd._srted method=range mult=&factor4mult out=&outdsd;
var &vars;
%if &ids ne %then %do;
by &ids;
%end;
run;
%if &round_or_not=... |
1864ab691c444dc848ddc650d1072425caced40c141e120ecd0b3f16a8457125 | SAS | 858 | 30 | %macro remove_newline_separator(mvar);
%*It is impossible to replace newline included in a macro var;
%*This is because SAS automatically transform newline as space;
%put it is impossible to replace newline in the var &mvar, as sas already automatically treats newline as space;
%abort 255;
%local newvar newline;
%let ... |
ee0036c1022b4bfbd6de222f058310d92721065ddcd32c883bfba89624d81846 | SAS | 859 | 41 | %macro ImportSinglePed(PedFile,outdsd,sep);
%if &sep eq %then %do;
Proc import datafile="&Pedfile" dbms=dlm out=&outdsd replace;
delimiter=' ';
getnames=no;guessingrows=1000;
run;
%end;
%else %do;
Proc import datafile="&Pedfile" dbms=dlm out=&outdsd replace;
delimiter=&sep... |
14a127b10e8409ce48f18ba09f828927120fe0f2a0ed9720a88d9a1f29a6420c | SAS | 862 | 30 | %macro remove_wrd(
sntnc, /*input sentence containing words*/
wrd /*target word to be removed from the input sentence;
note: the macro will add space before the target wrd for matching
it in the sentence, and then remove it!*/
);
%let sentence=%str( )%nrbquote(&sntnc);
%if &sentence^=%str( ) %then %do;
... |
f1620297ee370be253571997ef4c22a60616c96caee683b65838ad235c02fb40 | SAS | 864 | 38 | %macro CompareGenoA1A2(dsdin,Avarname1,Avarname2,Bvarname1,Bvarname2,dsdout);
data &dsdout (drop=g1_ g2_ gg1_ gg2_ g1__tr g2__tr);
set &dsdin;
g1_=compress(&Avarname1);
g2_=compress(&Avarname2);
gg1_=compress(&Bvarname1);
gg2_=compress(&Bvarname2);
g1__tr=translate(g1_,"ACGTacgt","TGCAtgca");
g1__tr=reverse(g1_... |
67b58b47d8b699190bf4159304631c5176f00a20ddb58b4719ee28d19601288b | SAS | 869 | 42 | %macro char2num_dsd(dsdin,vars,dsdout);
%let nv=%eval(%sysfunc(count(&vars,%str( )))+1);
%if %index(&vars,%str( )) %then %do;
%let _vars_=%sysfunc(prxchange(s/ /__ __/,-1,&vars));
%end;
%else %do;
%let _vars_=%sysfunc(prxchange(s/^/__/,-1,&vars));
%end;
%put old vars are &vars;
%put temperary new vars are ... |
4b882700707443b634073b5cd7bbcaf297629e09c7852615d18ab77067042a11 | SAS | 871 | 38 | %global var_type;
%macro check_var_type(dsdin,var_rgx);
proc contents data=&dsdin out=&dsdin._fmt noprint;
run;
proc sql noprint;
/*select distinct(TYPE) into: var_type separated by '|'*/
select TYPE into: var_type separated by '|'
from &dsdin._fmt
where prxmatch("/&var_rgx/i",NAME);
%put The types of variab... |
9873f370637683787bef5bc087f77e098cbf6f15c2591b42bcb42ad8f70fd69e | SAS | 872 | 60 |
%macro fmt_char_with_num(dsdin,var4fmt,var4sort,fmt_output_name,varname4fmtvar,dsdout);
/*
proc freq data=&dsdin;
table &var4fmt/noprint out=uniquevalues;
run;
*/
proc sort data=&dsdin out=uniquevalues nodupkyes;
by &var4sort;
run;
data fmtdsd;
set uniquevalues;
retain fmtname "&fmt_output_name" type 'C';
rename &var... |
4422163c6c501e96823110adb6657f170c5aa5ca5d5489f5df8b28662098986c | SAS | 879 | 23 | %macro list_in_list(/*a sas function keeps these query_list that exist in the base_list in the original order*/
query_list=,/*blank space separated elements for querying in the following base_list*/
base_list=/*blank space separated elements treated as a base list to be searched for elements in the query list*/
);
... |
01bd51369a92a10e0b67b8460b435dc72ec18691f0061f00defd4fb700e02dcd | SAS | 883 | 44 | *This macro needs to be revised;
%macro boxplot4gene(dsdin,gene,grp=grp,genevar=gene);
data gene_exp;
set &dsdin;
/*where _GeneSymbol_="MAP3K19";*/
/*Alias name of MAP3K19 is YSK4*/
where &genevar="&gene";
run;
proc glm data=gene_exp;
class &grp;
model exp=&grp;
/*means grp/duncan;*/
means &grp/t;
run;
... |
5bb1c25335ba5b256d8c588e72342ce3d208fc821aabf45daf1a39f015794b29 | SAS | 886 | 41 | %macro list_files4dsd(dir,file_rgx,dsdout);
options linesize=max;
proc printto log="&dir/list_files.tmp" new;
run;
%list_files(&dir,&file_rgx);
proc printto;run;
proc printto log=log;
run;
data &dsdout;
length fullpath $500;
infile "&dir/list_files.tmp" dsd;
input;
fullpath=_infile_;
if prxmatch("/&file_rg... |
e4981fbbe30e3349ba4078b0532cdad02149c971bc9ed4add7b060ac8f8f3076 | SAS | 889 | 20 | %macro get_covid_gwas_from_grasp(gwas_url,outdsd);
%let wkdir=%sysfunc(getoption(work));
%let gwas_gz_file=%sysfunc(prxchange(s/.*\///,-1,&gwas_url));
%dwn_http_file(httpfile_url=&gwas_url,outfile=&gwas_gz_file,outdir=&wkdir);
/*Put tmp data into sas work directory will save space*/
/* %ImportTXTFromZIP(zip=&wkdir/&gwa... |
148d74a5f40a8512822fc96efcfdbbb0d18b75bdba3a45a503cf6d1294814455 | SAS | 900 | 31 | *https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/sqlproc/p1tbuxpz7oo8hgn1nf807fqgi5xc.htm;
%macro countm(col);
*When running the macro for proc sql;
*it is necessary to add proc sql;
*select before %countm;
count(&col) "Valid Responses for &col",
nmiss(&col) "Missing or NOT VALID Responses for &col"... |
f51e6d4b7116c8a2767f8a060cf0833bf9762ecc0e4711b9b872752258ad66a2 | SAS | 937 | 30 | %macro listautos;
%local autoref i ref refpath;
/** Retrieve the value of the SASAUTOS option **/
%let autoref = %qsysfunc(getoption(sasautos));
%let i=0;
%do %until(&ref eq);
/** Pull off the first item contained within SASAUTOS **/
%let ref = %qscan(&autoref,&i+1,%str(() ,));
/** If everything has been read or if... |
ed573a96c29073ad56129b6eb8664d87e74973c7e48b7f1a7997e8b8b0075bbc | SAS | 940 | 38 | %macro long_line_dsd_exporter(dsdin,outfile);
*Note: the export procedure failed to export all vars when the ling length >32767;
/* proc export data=b outfile="&outdir/test.txt" dbms=tab replace; */
/* run; */
*https://communities.sas.com/t5/SAS-Programming/Exporting-data-to-excel/m-p/124791#M10407;
*export headers on... |
92ce1b0cdf321474483a87f804a920a31c970244ea6a20a1a93884cc94c5acc7 | SAS | 947 | 59 | %macro ranperm4enrichment_test(
perm_n=10,
n_gs=30,
n_random_cells=3,
dsdout=_perm_dsd_,
transpose_dsd=1
);
/*%let perm_n=10;*/
/*%let n_gs=30;*/
/*%let n_random_cells=3;*/
data &dsdout;
do i=1 to &perm_n;
array G{&n_gs} x1-x&n_gs.;
do gi=1 to &n_random_cells;
G{gi}=1;
end;
call streaminit... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.