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

Hi,

I want to Create Dynamic Parameters From Excel .

I have this structure:

Varvalue
current_offer5
ofer Structure10
4087_current0.21
Kizba_Adif_Q-10.0021
Kizba_Adif_Q-20.2
i_adif0.65

and the expected results :

&current_ofer=5 

ofer Structure=10

....

&i_adif=0.65

 

Any ideas?

 

Best Regards

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

Step 1: read the Excel file into a SAS data set named HAVE

 

Step 2:

 

data _null_;
    set have;
    call symputx(var,value);
run;

Please note that your second row, which has a space in the VAR column, will not work with this method (or any method) as macro variable names cannot have a space; and so you will have to fix the second row. 

--
Paige Miller

View solution in original post

3 REPLIES 3
PaigeMiller
Diamond | Level 26

Step 1: read the Excel file into a SAS data set named HAVE

 

Step 2:

 

data _null_;
    set have;
    call symputx(var,value);
run;

Please note that your second row, which has a space in the VAR column, will not work with this method (or any method) as macro variable names cannot have a space; and so you will have to fix the second row. 

--
Paige Miller
CurtisMackWSIPP
Lapis Lazuli | Level 10
Nor will those that start with numbers.
PaigeMiller
Diamond | Level 26

@CurtisMackWSIPP wrote:
Nor will those that start with numbers.

Good point! And macro variable names can't have hyphens in them either.

 

Looks like @jony123 will have to modify the VAR column in either Excel or SAS so that it conforms to the rules for macro variable names.

--
Paige Miller

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 3 replies
  • 999 views
  • 1 like
  • 3 in conversation