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

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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