BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ammarhm
Lapis Lazuli | Level 10

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

1 ACCEPTED SOLUTION

Accepted Solutions
FredrikE
Rhodochrosite | Level 12

 

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

 

View solution in original post

1 REPLY 1
FredrikE
Rhodochrosite | Level 12

 

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

 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1153 views
  • 0 likes
  • 2 in conversation