- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Does anyone have code that can pull in a bunch of SAS programs from location A and output them as .txt files in location B? Would save hours of work. Thanks!
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Open a cmd window, navigate to path_a with cd, and do
copy *.sas c:\path_b\*.txt
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Command line:
copy <path>/*.sas <path>
I mean SAS program files are just plain text programs. I don't see how this can take "hours of work"?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I have hundreds of programs - and the only way I knew how to do it was to open each one and do SAVE AS.
I am not really following the code you provided - if you could provide example paths that'd be helpful...thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
It's just the basic copy command of Windows. Use the commandline for it.
If your programs are stored on a non-Windows server, and you want to move/copy them there, you need to tell us more about your setup.
Why do you want to change the extension to .txt?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
It's required by the FDA
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
SAS program files are text files.
Are you asking how to copy files?
In Windows the command is COPY and in Unix it is cp.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to do something like this - but the below code won't work:
libname rna "C:\data";
%macro export_data (file=);
proc export data=rna.&file.
outfile="C:\data.&file..txt"
dbms= tab replace;
run;
%mend export_data;
%export_data (file= t-14-1-1a-ds);
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
So you are not converting programs, but datasets!
Your code won't work because t-14-1-1a-ds is not a valid SAS dataset name. SAS names can only contain letters (of the 26 character alphabet), digits and underlines, and must not start with a digit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@darb wrote:
Oh crap - I thought what I was looking at was someone trying to do the same. I now realize they were converting datasets. Womp. Ok thank you. So I should use command to copy from .sas to .txt?
Let's get back to square one and make some things clear:
- programs or datasets?
- from where to where?
- and why change the extension to .txt, if it's not data but program code?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Open a cmd window, navigate to path_a with cd, and do
copy *.sas c:\path_b\*.txt
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I am sorry, where did you get the idea that .sas programs need to be called .txt? It does not make sense, and is counter-productive. Examine the guidance for industry:
https://www.fda.gov/downloads/ForIndustry/DataStandards/StudyDataStandards/UCM241502.pdf
In particular page 5 of 12, which states:
Any requested programs (scripts) generated by an analysis tool should be provided as ASCII text files and should include sufficient documentation to allow a reviewer to understand the submitted programs. If the programs created by the analysis tool use a file extension for ASCII text files other than .txt, the file name should include the native file extension generated by the analysis tool for ASCII text program files, e.g. myRcode.r, mySAScode.sas, etc. If the analysis tool does not save programs in ASCII format, a PDF rendition of the program file should be provided in addition to the program file
SAS programs should be sent as they are with the file extension .sas. They are plain text files, and are associated with the SAS software.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I had an inkling that this is a result of misunderstanding, or misinterpretation of some guideline.