Created
June 21, 2025 10:51
-
-
Save andyc1997/654d7fd9582580d943dc12b499cb33dd to your computer and use it in GitHub Desktop.
Create an output directory using the current time as its name. Tested on SAS V9 engine.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%let p_path = /home/xxxxx/yyyyy/; | |
%let cur_date = %sysfunc(today(), yymmddn8.); | |
%let cur_hh = %sysfunc(hour(%sysfunc(time()))); | |
%let cur_mm = %sysfunc(minute(%sysfunc(time()))); | |
%let d_name = &cur_date._&cur_hh._&cur_mm.; | |
%put NOTE: folder name = &d_name; | |
data _null_; | |
rc = dcreate("&d_name", "&p_path"); | |
if missing(rc) then do; | |
f_failed = "NOTE: The directory &p_path.&d_name. already exists"; | |
put f_failed; | |
end; | |
else do; | |
f_created = cats("NOTE: The following directory is created: ", rc); | |
put f_created; | |
end; | |
run; | |
%let out_path = &p_path.&d_name.; | |
%put NOTE: The output path is &out_path; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment