BookmarkSubscribeRSS Feed
heleen_w
Calcite | Level 5

Hi Forum,

 

 

I would like SAS EG or SAS Studio to create a sub directory on Windows filesystem as the month previous to the one we are currently in, on the Windows file system however; so for example I would like that here

 Q:\\BLAHBLAH\blahblah\5 

Gets created on the previously existing

Q:\\BLAHBLAH\blahblah\

 

From with the UNIX-based SAS which resides I-don't know-where-but-probably-something-like-/opt/sas/... on some server-side which I cannot see. (I have no clue if I can write on that particular Q:\\ win-subdirectory but I tried having SAS output with ODS an excelfile in that path, this works.)

 

Since we are now in June the to be created sub dir should be '5' - so I created a variable which will return me the 5 like such

/*creates dir*/
%let P_month = %sysfunc(month(%sysfunc(intnx(month, %sysfunc(today()), -1))));
%put The Previous Month (based on one month back) is: &p_month;
run;

 

This works but;

How can I incorporate it into a statement to get the dir creation done?

DLCREATEDIR is not working/unallowed probably, DCREATE will not return an error but also do nothing (as in I see no win dir getting created and no log error), is it possible its logging is incomplete?

 

 

Thanks!

Kind regards,

heleen

1 REPLY 1
yabwon
Amethyst | Level 16

If I understood you correctly, you are running SASon server, you are connected to the server by SAS EG,  and you want to create a new directory on your local drive?  

If this is the setup, then the answer is: you won't be able to do this.

Such a try in real life could be compared to try of putting food into an oven using Zoom/Teams call. 

 

If the SAS Server could create an Excel file and you can see the file on Q: drive, this probably means the drive is a network drive and it is your local windows connecting to it, and for the server, what you can see as "Q:\\BLAHBLAH\blahblah" is probalbly "/..<some/sub/path/here>../BLAHBLAH/blahblah/"

 

So if you want create sub-dir there you should use, the server path. 

 

 

Bart

 

 

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 1 reply
  • 613 views
  • 0 likes
  • 2 in conversation