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

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?

 

1 ACCEPTED SOLUTION
2 REPLIES 2
ThierryHerrie
Obsidian | Level 7
Many thanks! Works like a charm.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 2 replies
  • 927 views
  • 1 like
  • 2 in conversation