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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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