Reputation: 6913
I am trying to print out a delimited file, without having to specify all of the columns. I can get close, but the numeric columns are always quoted:
DATA _NULL_;
SET SASHELP.CARS (obs = 5 keep = Make Model EngineSize);
FILE "foo.csv" DSD DLM=",";
PUT (_all_) (~);
RUN;
foo.csv
"Acura","MDX","3.5"
"Acura","RSX Type S 2dr","2"
"Acura","TSX 4dr","2.4"
"Acura","TL 4dr","3.2"
"Acura","3.5 RL 4dr","3.5"
How can I achieve either:
"Acura","MDX",3.5
"Acura","RSX Type S 2dr",2
"Acura","TSX 4dr",2.4
"Acura","TL 4dr",3.2
"Acura","3.5 RL 4dr",3.5
or:
Acura,MDX,3.5
Acura,RSX Type S 2dr,2
Acura,TSX 4dr,2.4
Acura,TL 4dr,3.2
Acura,3.5 RL 4dr,3.5
Upvotes: 3
Views: 167
Reputation: 63424
~
asks for quoting. So, you're getting quoting.
You can use &
instead:
DATA _NULL_;
SET SASHELP.CARS (obs = 5 keep = Make Model EngineSize);
FILE "c:\temp\foo.csv" DSD DLM=",";
PUT (_all_) (&);
RUN;
&
has effectively no impact on the data (we've had a question about it once upon a time, I don't recall the ultimate answer, but basically it seems to mostly be used for this specific purpose, even though that's not its purpose).
Upvotes: 3