BookmarkSubscribeRSS Feed
AlexeyS
Pyrite | Level 9

Hello, i want to import Json file, i did it and the program work well, but i want to write it in macro. Instead full_address variable i want to put macro variable &comm.

but when i write it as is, it's not work, i tried different options, but still i didn't get answer.

What i should do?  thank you

filename business "&lnk_input2\name.json";

%macro flexdata(data,comm,output);

data &output;

      infile &data lrecl=255 truncover scanover;

      input @ '"full_address": "' &comm $240.;

      &comm=substr(&comm,1,index(&comm,'",')-1);

run;

%mend;

%flexdata(data=business,comm=full_address, output=business2);

1 REPLY 1
Reeza
Super User

I don't see anything explicitly wrong with your code. It is a bit weird to have the filename defined outside the macro? Wouldn't you have to define it for all files then?

 

Have you tried running your macro with SYMBOLGEN and MPRINT on?

 

OPTIONS SYMBOLGEN MPRINT;

 

Also, are you generating any errors in your code that are displayed to the log. 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1 reply
  • 803 views
  • 0 likes
  • 2 in conversation