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

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 809 views
  • 1 like
  • 3 in conversation