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

Hi All,

If I have this format

proc format;

VALUE $DOM

'AE' = 'USUBJID AETERM AESTDTC'

'CE' = 'USUBJID CETERM CESTDTC'

'CM' = 'USUBJID CMTRT CMROUTE CMSTDTC'

'DD' = 'USUBJID'

'DM' = 'USUBJID'

;

run;

 

I have the macro variables which take the value AE, CE etc, how can I definy a new macro variable which will take 'USUBJID AETERM AESTDTC' for AE??

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

For example

 

data _null_;
    call symputx("newmacrovariable",put("&origmacrovariable",$dom.));
run;

As a side issue (but it may be relatively important), you don't normally apply formats to macro variables, and it may be there's an easier way to achieve whatever it is you are doing without macro variables, or without formats. I can say more because I'd need a lot more details about what you are doing.

 

--
Paige Miller

View solution in original post

3 REPLIES 3
PaigeMiller
Diamond | Level 26

For example

 

data _null_;
    call symputx("newmacrovariable",put("&origmacrovariable",$dom.));
run;

As a side issue (but it may be relatively important), you don't normally apply formats to macro variables, and it may be there's an easier way to achieve whatever it is you are doing without macro variables, or without formats. I can say more because I'd need a lot more details about what you are doing.

 

--
Paige Miller
Jomaa
Calcite | Level 5
Thanks so much..your code above gave me what I want. Actually I'm comparing old vs current transfer, I have the list of domains in a macro variable, I need to associate it with key variables.
Astounding
PROC Star

%let newvar = %sysfunc(putc(&oldvar, $dom));

 

 

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

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 3 replies
  • 1638 views
  • 0 likes
  • 3 in conversation