BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
NewSASuser2018
Obsidian | Level 7

Hi Commuity,

 

I have a very simple problem you can probably easily resolve. 

 

I have the following macro:

%macro Interval(secs);

data forexExport;
set want7;
minutestime = floor(seconds_time/(&secs.));
run;

data forexExport;
  set forexExport;
  by minutestime;
  if last.minutestime;   
run;

data forexExport;
set forexExport;
log_price = log(RateBid + (RateAsk - RateBid)/2);
run;

proc export data=work.forexExport 
   outfile='F:\data\EUR_USD_201517_&secs.sec.csv'  <- ERRONEOUS LINE
   dbms=csv
   replace;
run;


%mend;

%Interval(900);

the issues lies in the outfile statement (marked with an arrow for you). What it is supposed to do is take the input variable, which in this case is set to 900 and use is within the filename. After exporting, it should basically read "EUR_USD_201517_900sec". What it does read instead is "EUR_USD_201517_&secs.sec" so what I used to reference within the macro. I am new to sas so I have trouble finding the issue with my referencing.

 

Thank you very much in advance!

 

Best wishes

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

You need to put double quotes around macro variables to get them to resolve:

   outfile="F:\data\EUR_USD_201517_&secs.sec.csv" 

 

View solution in original post

2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

You need to put double quotes around macro variables to get them to resolve:

   outfile="F:\data\EUR_USD_201517_&secs.sec.csv" 

 

NewSASuser2018
Obsidian | Level 7
Thank you very much!

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
  • 2 replies
  • 429 views
  • 1 like
  • 2 in conversation