LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (February 1997, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 19 Feb 1997 19:54:02 GMT
Reply-To:     QLXKWS <qlxkws@AOL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         QLXKWS <qlxkws@AOL.COM>
Organization: AOL http://www.aol.com
Subject:      Re: Delimiter File Write

Hey Robert, Here is what I have done for a client. I can use any delimiter I want by addressing it in the retain statement.

%let outfile= Your output file; %let outas= NEW; /* to overwrite any existing, or blank to append */ %let delim= your desired delimiter in quotes - ie ',' '09'x (tab), etc ... data _null_;

file "&outfile" &outas notitles;

RETAIN _DLM_ &delim;

length _DSID_ _OBS_ _VARS_ 4 _VNAME_ $8 _VTYPE_ $1

_VFMT_ $12 _VLBL_ $40 _TXT_ $200;

_DSID_=open('WORK.PRINTSQL','I');

_OBS_=attrn(_DSID_,'NLOBS');

_VARS_=attrn(_DSID_,'NVARS');

do _i_=1 to _VARS_;

_VNAME_=varname(_DSID_,_I_);

_VLBL_ =varlabel(_DSID_,_I_);

if _VLBL_ ne ''

then put _VLBL_ @;

else put _VNAME_ @;

if _i_<_VARS_

then put +(-1) _DLM_ +(-1) @;

else put;

end;

do while(fetch(_DSID_)=0);

do _i_=1 to _VARS_;

_VTYPE_=vartype(_DSID_,_I_);

_VFMT_ =varfmt(_DSID_,_I_);

if _VTYPE_='C'

then

do;

_TXT_=getvarc(_DSID_,_I_);

if _VFMT_ ne '' then _TXT_=putc(_TXT_,_VFMT_);

end;

else

do;

if _VFMT_ eq '' then _VFMT_='BEST.';

_TXT_=putn(getvarn(_DSID_,_I_),_VFMT_);

end;

put _TXT_ @;

if _i_<_VARS_

then put +(-1) _DLM_ +(-1) @;

else put;

end;

end; /* Do while */

_DSID_=close(_DSID_);

run;

Let me know if this helps/works for you! Enjoy!

Karl W. Schaefer Qualex Consulting Services, Inc. (804) 736-0181 Karl W. Schaefer QLXKWS@aol.com (804) 736-0181


Back to: Top of message | Previous page | Main SAS-L page