DATA Step, Macro, Functions and more

how to make a macro variables

Reply
Occasional Contributor
Posts: 9

how to make a macro variables

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.;

Attachment
Trusted Advisor
Posts: 1,137

Re: how to make a macro variables

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
Occasional Contributor
Posts: 9

Re: how to make a macro variables

Posted in reply to Jagadishkatam

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

SAS Super FREQ
Posts: 8,868

Re: how to make a macro variables

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
PROC Star
Posts: 1,324

Re: how to make a macro variables

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.

Ask a Question
Discussion stats
  • 4 replies
  • 239 views
  • 0 likes
  • 4 in conversation