Hi,
I'm exporting data from the sas dataset into .txt file with preserving leading spaces. In the sas dataset there are around 50 columns and only one column (REF) has leading spaces.
filename XAB "&SOURCE_FILE";
data _null_;
set TEMP_XAB;
file XAB dsd dlm='|';
put (_all_) (+0) REF $char15.;;
run;
But if I have the code as like above, it creates an extra column with leading spaces for REF column in txt. file.
Even I will not able to put all the 50 column names and only for that REF column will have that char format in the put statement.
Is there any possible way to have that only column as format char string and the remaining column as it is from the dataset before creating the .txt file.
Thanks
Thanks
Data is critical for such as this.
Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the </> icon or attached as text to show exactly what you have and that we can test code against.
Since this is an output related task then likely only need to provide 5 lines of actual data.
THEN you need to provide text as you expect that output to appear. Post such text in a code box opened with the </> because the main message windows will remove white space characters like blanks.
It is extremely likely that your existing vales do not contain leading spaces.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.