BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Yes, you would need to sort it, sorry, I should have thought of that - its what happens if I can't test things.  Put your rename on the datastep - also note how I use the code window which is the {i} above the post area, and format my code for readability - i.e. avoid using mixed case.  A final point, it seems to me like the requirement changed somewhere, are you now saying that there is a variable in the data which holds the year value?  If so then we can simplify it:

/* Step 1 - set all data together, and put year in as a data item */
data inter;
  set hyptabs.src_utah_vitals: ;   /* See here I use : to mean all datasets with that prefix */
run;

proc sort data=inter;
by apptdata;
run; /* Transpose the data */ proc transpose data=inter out=want; by year; var value; idlabel measure; run;

data want;
set want (rename=(apptdate=visitdt ssn=ssn1 col1=htln ...));
run;

 

 

Develop Code with SAS Studio

Get started using SAS Studio to write, run and debug your SAS programs.

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
  • 15 replies
  • 4155 views
  • 0 likes
  • 4 in conversation