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
Onyx | Level 15

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



SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 276 views
  • 0 likes
  • 2 in conversation