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
SAS Super FREQ

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.

BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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