@BGM , @publicdomain and helpful community.
BGM, your idea is a good one. Copy out, then copy back in. Or rename. Etc.
Trouble is, the file contents will change.
Here is the actual scenario:
I have 100 SAS datasets. Each dataset is alone in its folder. The folder name corresponds to the dataset filename, plus some extra:
Below are the first three folders, and the sole file inside:
===========
E:\00\AAPL\
===========
aapl_combined.sas7bdat
===========
E:\00\ACWI\
===========
acwi_combined.sas7bdat
===========
E:\00\ACWX\
===========
acwx_combined.sas7bdat
I need to update -- add some additional columns -- to each and every dataset file.
The 'program' -- or more accurately, 'script' -- I am going to use to make the changes to each file expects the name of the file to be:
combined.sas7bdat
No prefix.
And the location of said file is set to be:
C:\SAS_1\
So, it appears that I'll have to use one of the two following approaches:
(first dragging each respective file one at a time to the 'work' folder for the running of the script)
1. Change the 'script' file 100 times, to tailor for the specific prefix.
or
2. Change the name of each file, temporarily. x100.
Going #2 route, I was thinking of TEMPORARILY changing the filename:
aapl_combined.sas7bdat --> combined.sas7bdat
Then making changes to the dataset file with the existing script.
Then changing the filename back to what it was before:
combined.sas7bdat --> aapl_combined.sas7bdat
Then dragging the changed dataset file back to its proper, home folder.
This whole rigmarole is likely faced regularly by programmers. There surely are ways and means of conducting things more efficiently. If anyone wants to chime in their thoughts regarding a more orderly process, please speak up.
Thanks much!
Nicholas Kormanik
Good suggestion @Ath. Unfortunately I don't see that SAS will allow ambiguity with the dataset it's acting on.
Here's partial code:
proc summary data=sas_1.combined;
var
i_50501_Z
i_50502_Z
i_50503_Z
i_50504_Z
i_50505_Z
i_50508_Z
;
output out=sas_1.combined_temp (drop= _:) p80= /autoname;
run;
The .combined part refers to the dataset being acted upon. I don't believe I can use a wildcard there.
I would need to change dataset filenames. Or change script.