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"

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1280 views
  • 0 likes
  • 4 in conversation