BookmarkSubscribeRSS Feed
oujiang
Calcite | Level 5

hi!

i want to make a macro variables,but it can not be used,here is my code; and attachment is my data set.

proc sql;

select f into: g separated by ""

from f;

quit;

%put &g.;

4 REPLIES 4
Jagadishkatam
Amethyst | Level 16

i tried the same and i can see that the macro variable was created without any problem.

I hope you wish to get the value of the f variable within the dataset f into a macro variable called g. if this is the case then your code should work well. Was there any error or warning reported while executing the code.

Thanks,

Jagadish

Thanks,
Jag
oujiang
Calcite | Level 5

yes,I can use it with SAS9.2,but SAS9.3 will appear "I/O"error!

Cynthia_sas
Diamond | Level 26

Hi:

  Very perplexing indeed! I got access to a SAS 9.3 machine and didn't have any issues with the code (see screen shot). I ran the program twice...once with separated by "" (quote-quote) and the second time separated by " " (quote-space-quote) and as you can see, both times worked correctly. Although how you would use the first macro variable without any separators is another puzzle.

  However, I'd recommend that you work with Tech Support on this, An I/O error is something that needs to be investigated more thoroughly, where someone looks at your entire log, at the *EXACT* message and at various settings that might impact the execution.

cynthia


make_macro_var.png
Quentin
Super User

Cynthia's suggestion to work with tech support is a good one.

If you want more thoughts from here, might suggest you write a little program that creates work.f, followed by your proc SQL step.  Then batch submit that program and see if you get the same I/O error.  And if you do, post the code and log here for others to try running and see if they get the same error.

The SQL step you showed could be copied straight out of a macro language course.  Must be something odd going on.

--Q.

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
  • 4 replies
  • 1807 views
  • 0 likes
  • 4 in conversation