Hi everyone
A quick one. i have a code that transforms a table (ICD10 into __ICD10):
proc transpose data=ICD10 out=_ICD10;
var l:;
run;
proc transpose data=_ICD10 out=__ICD10;
by _name_;
var col:;
run;
data ___ICD10;
set __ICD10;
where col1 ne '';
run;
The problem is that I need to do the same thing for ICD7, ICD8, ICD9 and ICD10. My question is, is there a way to care a macro version from the above code to call and use with ICD7-ICD10 instead of repeating the code? All intermediate files can also be deleted to avoid cluttering.
Thanks
rsubmit;
%macro tsp(icdNum);
proc transpose data=&icdNum out=_&icdNum;
var l:;
run;
proc transpose data=_&icdNum out=__&icdNum;
by _name_;
var col:;
run;
data ___&icdNum;
set __&icdNum;
where col1 ne '';
run;
%mend;
%tsp(ICD7);
%tsp(ICD8);
%tsp(ICD9);
%tsp(ICD10);
endrsubmit;
Might work :)?
//Fredrik
rsubmit;
%macro tsp(icdNum);
proc transpose data=&icdNum out=_&icdNum;
var l:;
run;
proc transpose data=_&icdNum out=__&icdNum;
by _name_;
var col:;
run;
data ___&icdNum;
set __&icdNum;
where col1 ne '';
run;
%mend;
%tsp(ICD7);
%tsp(ICD8);
%tsp(ICD9);
%tsp(ICD10);
endrsubmit;
Might work :)?
//Fredrik
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.