BookmarkSubscribeRSS Feed
Flip
Fluorite | Level 6
run http://support.sas.com/rnd/base/ods/odsmarkup/csvtags.tpl

then use tehh Proc print as I told you. This will allow the use of the delimiter in SAS 9.1
data_null__
Jade | Level 19

OK then.

183  data class;

184     set sashelp.class;

185     if _n_ in(1,4,5,19) then substr(name,3,1)='|';

186     else if _n_ in(3,6,7) then call missing(of _all_);

187     run;

NOTE: There were 19 observations read from the data set SASHELP.CLASS.

NOTE: The data set WORK.CLASS has 19 observations and 5 variables.

NOTE: DATA statement used (Total process time):

      real time           0.01 seconds

      cpu time            0.01 seconds

188

189  data _null_;

190     set class;

191     file log dlm='|' dsd;

192     if _n_ eq 1 then link names;

193     put (_all_)(~);

194     return;

195  names:

196     length _name_ $32;

197     do while(1);

198        call vnext(_name_);

199        if upcase(_name_) eq '_NAME_' then leave;

200        put _name_ ~ @;

201        end;

202     put;

203     return;

204     run;

"Name"|"Sex"|"Age"|"Height"|"Weight"

"Al|red"|"M"|"14"|"69"|"112.5"

"Alice"|"F"|"13"|"56.5"|"84"

" "|" "|"."|"."|"."

"Ca|ol"|"F"|"14"|"62.8"|"102.5"

"He|ry"|"M"|"14"|"63.5"|"102.5"

" "|" "|"."|"."|"."

" "|" "|"."|"."|"."

"Janet"|"F"|"15"|"62.5"|"112.5"

"Jeffrey"|"M"|"13"|"62.5"|"84"

"John"|"M"|"12"|"59"|"99.5"

"Joyce"|"F"|"11"|"51.3"|"50.5"

"Judy"|"F"|"14"|"64.3"|"90"

"Louise"|"F"|"12"|"56.3"|"77"

"Mary"|"F"|"15"|"66.5"|"112"

"Philip"|"M"|"16"|"72"|"150"

"Robert"|"M"|"12"|"64.8"|"128"

"Ronald"|"M"|"15"|"67"|"133"

"Thomas"|"M"|"11"|"57.5"|"85"

"Wi|liam"|"M"|"15"|"66.5"|"112"

NOTE: There were 19 observations read from the data set WORK.CLASS.

NOTE: DATA statement used (Total process time):

      real time           0.03 seconds

      cpu time            0.03 seconds

Peter_C
Rhodochrosite | Level 12
couldn't be simpler
Suppose you have a list of the required columns in a macro variable: &columns, like for eample, from sample table sashelp.class[pre] %let columns = name age height ;[/pre] then there is a format modifier that will quote the variables[pre]data _null_ ;
file 'your.pipe.file.txt' lrecl=10000 dsd dlm='|' ;
set sashelp.class ;
put (&columns)(~) ;
run ;[/pre]
It is that tilde(~) modifier which quotes the columns.

PeterC
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Question back to the OP prem85:

With all the feedback you have received, what, if any, attempt have you made to exercise some of these various approaches and technical options? You keep regurgitating your "quest" but it doesn't appear you are embracing what's been provided and tell us what progress and/or success you have been able to achieve with the forum feedback.

Scott Barry
SBBWorks, Inc.
deleted_user
Not applicable
Sorry for the delay i'm currently out of station and i can get back to my system loaded with reponse only on Monday .Thanks for the quick response of all the members in the forum.I shall try out the methods suggested on monday and get back back to you all with the results.Thanks again
deleted_user
Not applicable
Thanks for all the members who was patient enough to answer my question.It worked Mr.Data_null_ and Mr.Peter .Thanks for the help
deleted_user
Not applicable
In the same ,how to export the variable name also?
Flip
Fluorite | Level 6
Proc print will put the variable names in the first row.
But then why take the easy route?
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
The DS2CSV approach provides choice between "label" or "variable name". Very straightforward and code that you could most likely support yourself going forward.

Scott Barry
SBBWorks, Inc.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Multiple solutions have been suggested. Also consider using the SAS-supplied DS2CSV utility macro with the SEPCHAR= parameter.

Recommended Google advanced search argument for this topic/post:

ds2csv site:sas.com

Scott Barry
SBBWorks, Inc.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 24 replies
  • 12415 views
  • 0 likes
  • 5 in conversation