BookmarkSubscribeRSS Feed
jkim1012
Calcite | Level 5

Hi all. 

 

 ***********************UPDATED LOG****************************

 

I am trying to read monthly CSV files into SAS each month. But the macro is not readable in filename statement. Please take a look at the code to see what I am missing.

 

DATA _NULL_;
tday = INTNX('month',today(),-2,'B');
CALL SYMPUT('chknm',PUT(tday,monyy5.));
RUN;
%put &chknm.;

filename btv1 FTP "/CustomerDelivery/btv/&chknm.._chk2.csv"
host = "&nthost"
user = "&ntid"

 

 And this is the LOG from the code above...

 

21 %put &chknm.;
JAN18
22
23 filename btv1 FTP "/CustomerDelivery/btv/&chknm.._chk2.csv"
24 host = "&nthost"
25 user = "&ntid"

 

 

Thanks!!

4 REPLIES 4
ballardw
Super User

So, Which did you submit:

filename btv1 FTP "/CustomerDelivery/btv/&chknm.._chk2.csv"

or (from log)

filename btv1 FTP "/CustomerDelivery/btv&chknm.._chk2.csv"

 

one of these is not like the other. A missing / would be very critical in finding the file.

 

Your log is incomplete as you do not show the end of the filename statement or any message about success or failure.

 

If you want to see the resolved values use

Options mprint;

before the code and then

Options nomprint;

to stop the resolution in the log.

jkim1012
Calcite | Level 5

Updated the log. it was with "/"

 

18 DATA _NULL_;
19 tday = INTNX('month',today(),-2,'B');
20 CALL SYMPUT('chknm',PUT(tday,monyy5.));
21 RUN;

NOTE: DATA statement used (Total process time):
real time 0.06 seconds
user cpu time 0.01 seconds
system cpu time 0.01 seconds
memory 738.15k
OS Memory 19616.00k
Timestamp 03/27/2018 01:42:05 PM
Step Count 12 Switch Count 30
Page Faults 0
Page Reclaims 133
Page Swaps 0
Voluntary Context Switches 111
Involuntary Context Switches 21
Block Input Operations 0
Block Output Operations 0

22 %put &chknm.;
JAN18
23
24 filename btv1 FTP "/CustomerDelivery/btv/&chknm.._chk2.csv"
25 host = "&nthost"
26 user = "&ntid"
27 pass = "&ntpwd"
28 WAIT_MILLISECONDS=1000000;
29
30 Options nomprint;
31

Tom
Super User Tom
Super User

You defined a FILENAME, but you haven't done anything with it yet.

Were you going to try to read that file? Or write to it?

Patrick
Opal | Level 21

@jkim1012

Additionally to what @Tom wrote: Why are there two dots after &chknm. Is the filename you're after really JAN18._chk2.csv

 

22 %put &chknm.;
JAN18
23
24 filename btv1 FTP "/CustomerDelivery/btv/&chknm.._chk2.csv"

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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