Hi,
I've got a dataset that looks like this:
DATA work.kip ;
LENGTH ref $7. q1_2019 q2_2019 q3_2019 q4_2019 8. ;
INFILE CARDS TRUNCOVER ;
INPUT ref q1_2019 q2_2019 q3_2019 q4_2019 ;
CARDS ;
q1_2019 1369 3625 3679 36875
q3_2019 6369 4587 5637 8963
q2_2019 123 456 789 123
q2_2019 3568 69876 3685 7896
;
RUN ;
The REF variable contains the name of the variable I would like to store in a new variable AMOUNT. I could use an IF THEN ELSE statement, but I is there a way to get the value of the variable name stored in REF?
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.