This is probably pretty simple, but i want to add an underscore in front of a numeric variable.

Accepted Solution Solved
Reply
Contributor
Posts: 30
Accepted Solution

This is probably pretty simple, but i want to add an underscore in front of a numeric variable.

This is for macro automation purposes,  I want to use my first variable x, to create a macro for the 2nd variable var2 which I already have code for

data _null;

set boundvec;

call symputx(x,var2,'G');

run;

but of course I get an error because x is a number; how can I simply add underscores infront of my x variables?

obs  x     var2

11521.25175485
22855.9807884
331422.6889005
441929.7196005
552456.6264165
663641.1847645
774406.201729

Accepted Solutions
Solution
‎07-25-2014 12:47 PM
Super Contributor
Posts: 333

Re: This is probably pretty simple, but i want to add an underscore in front of a numeric variable.

Is this what you are looking for?:

call symputx( cats("_",x),var2,'G');

Hope this helps!

EJ

View solution in original post


All Replies
Solution
‎07-25-2014 12:47 PM
Super Contributor
Posts: 333

Re: This is probably pretty simple, but i want to add an underscore in front of a numeric variable.

Is this what you are looking for?:

call symputx( cats("_",x),var2,'G');

Hope this helps!

EJ

Contributor
Posts: 30

Re: This is probably pretty simple, but i want to add an underscore in front of a numeric variable.

Exactly

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 171 views
  • 0 likes
  • 2 in conversation