Hi There
I want to add blank spaces at the end of my exported .csv file.
The csv file is formatted correctly but I cannot get the blank spaces at the end. It stops at 475 but need it to continue to col 600
The data is all concatenated into 1 string and is all converted to text as per attached
PROC EXPORT DATA=work.W4NV5KA
OUTFILE="\\xxxx\xxx\xxxx\Test.txt";
DBMS=CSV REPLACE;
PUTNAMES=NO;
RUN;
It sounds like you need a fixed width format instead? But that wouldn't make sense with a comma delimited file.
Your best bet is a manual export using a data step you can specify the LRECL to indicate your record length.
You can start off by using the code generated in the log from your PROC EXPORT and add the LRECL to the FILE statement.
File statement docs
Do you mean jsut add the LRECL = 650 for example below?
PROC EXPORT DATA=work.W4NV5KA
OUTFILE="\\xxxx\Test.txt" LRECL=650
DBMS=TAB REPLACE;
PUTNAMES=NO;
RUN;
@Aidan wrote:
Do you mean jsut add the LRECL = 650 for example below?
PROC EXPORT DATA=work.W4NV5KA
OUTFILE="\\xxxx\Test.txt" LRECL=650
DBMS=TAB REPLACE;
PUTNAMES=NO;
RUN;
LRECL is not a valid option in PROC EXPORT. I'm not seeing a way to do this using PROC EXPORT. The first link has an example of the data step code. You'd change the LRECL in the FILE statement in the data step.
I'm assuming that setting the 'string' to a length of 650 didn't automatically give you a length of 650.
Errm, CSV = Comma Separated Variable file. What does spaces have to do with this? The comma is the delimiter.
@Aidan wrote:
Just seeing if its possible
Note with proc export. Export is very limited.
It is possible. Stupid, but possible.
Use a FILENAME statement so you can tell SAS that your file should be fixed length.
filename csv temp lrecl=30 recfm=f;
proc export data=sashelp.class file=csv replace
dbms=csv
;
run;
data _null_;
infile csv length=len;
input;
put _n_ 3. len 3. +1 _infile_;
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.