BookmarkSubscribeRSS Feed
Ragineejoshi
Fluorite | Level 6

Hi SAS Experts,

I need help with this problem.

 

Suppose you are study lead and have been given a task to create standard folder structure for your study.

I have to create a macro that will take path as input ..

DATA
--sdtm
--adam
--raw
PROGRAM
--sdtm
--adam
--tlg
QCPROGRAM
--sdtm
----output
--adam
-----output
--tlg
----output
OUTPUT
--tlg
DOC
--email

(Requirements:  check whether path parameter is non missing (Required or mandatory), if its missing then send user generated error message and exit out
else if Check whether the path passed by the users exist on the server, if not the send user generated error message and exit out of the macro.

then you create folder structure.)

2 REPLIES 2
Reeza
Super User

1. Check if the folder/directory exists using DINFO() function

http://support.sas.com/documentation/cdl/en/hostwin/69955/HTML/default/viewer.htm#p0qzctpnc6pi8sn1qc...

 

2. Create folders using DCREATE()

https://documentation.sas.com/?docsetId=lefunctionsref&docsetTarget=p1aj29pf4cxnirn15q5hmf0tv438.htm...

 

If you're new to SAS you may want to first make sure this works without macro logic and then implement the macro logic. 

 


@Ragineejoshi wrote:

Hi SAS Experts,

I need help with this problem.

 

Suppose you are study lead and have been given a task to create standard folder structure for your study.

I have to create a macro that will take path as input ..

DATA
--sdtm
--adam
--raw
PROGRAM
--sdtm
--adam
--tlg
QCPROGRAM
--sdtm
----output
--adam
-----output
--tlg
----output
OUTPUT
--tlg
DOC
--email

(Requirements:  check whether path parameter is non missing (Required or mandatory), if its missing then send user generated error message and exit out
else if Check whether the path passed by the users exist on the server, if not the send user generated error message and exit out of the macro.

then you create folder structure.)


 

ballardw
Super User

You comments about "server" and "users" bring up several concerns about permissions and access that may be external to SAS or your SAS system. Also will your users know how to place a path on the server correctly?

 

 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1010 views
  • 0 likes
  • 3 in conversation