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 (May 2003, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 8 May 2003 09:53:06 -0400
Reply-To:     "Droogendyk, Harry" <Harry.Droogendyk@CIBC.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Droogendyk, Harry" <Harry.Droogendyk@CIBC.COM>
Subject:      Re: How to label the variables? (export output to text file)
Content-Type: text/plain; charset="iso-8859-1"

Actually, the point is to USE the EXPORT procedure. The EXPORT procedure does insert column names in the first record of the exported file.

/********************************************************************** 48 * PRODUCT: SAS 49 * VERSION: 8.2 50 * CREATOR: External File Interface 51 * DATE: 08MAY03 52 * DESC: Generated SAS Datastep Code 53 * TEMPLATE SOURCE: (None Specified.) 54 ***********************************************************************/ 55 data _null_; 56 set WORK.A end=EFIEOD; 57 %let _EFIERR_ = 0; /* set the ERROR detection macro variable */ 58 %let _EFIREC_ = 0; /* clear export record count macro variable */ 59 file 'c:\temp\export.txt' delimiter='09'x DSD DROPOVER lrecl=32767; 60 format name $6. ; 61 format phone $8. ; 62 format age best12. ; 63 if _n_ = 1 then /* write column names */ 64 do; 65 put 66 'name' 67 '09'x 68 'phone' 69 '09'x 70 'age' 71 ; 72 end; 73 do; 74 EFIOUT + 1; 75 put name $ @; 76 put phone $ @; 77 put age ; 78 ; 79 end; 80 if _ERROR_ then call symput('_EFIERR_',1); /* set ERROR detection macro variable */ 81 If EFIEOD then 82 call symput('_EFIREC_',EFIOUT); 83 run;

-----Original Message----- From: Jim Groeneveld [mailto:J.Groeneveld@ITGROUPS.COM] Sent: Thursday, May 08, 2003 9:47 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: How to label the variables? (export output to text file)

Hi C.F.,

It should be possible to directly write the variable names to the first line of a tab delimited file, followed by lines of data. The variable names may be obtained via macro variable(s), VNAME or SASHELP. The point is not to use the EXPORT proc.

Regards - Jim. -- Y. (Jim) Groeneveld, MSc IMRO TRAMARKO tel. +31 412 407 070 senior statist./data man. P.O. Box 1 fax. +31 412 407 080 J.Groeneveld@ITGroups.com 5350 AA BERGHEM, NL www.imrotramarko.com

My computer is out of inspiration at the moment, and my inspiration comes out of my computer.

Notice of confidentiality: this e-mail may contain confidential information intended for the addressed recipient only. If you have received this e-mail in error please delete this e-mail and please notify the sender so that proper delivery can be arranged.

> -----Original Message----- > From: C.F. Yiu [mailto:yiu628fan@YAHOO.COM.HK] > Sent: 08 May 2003 05:52 > To: SAS-L@LISTSERV.UGA.EDU > Subject: How to label the variables? (export output to text file) > > > Hi all, > I would like to export the SAS output to a tab delimited > text file with > labeled variable names. For illustration: > > data company; > infile 'c:\comp.hk'; > input COID LOCA $; > > proc export data=company > outfile='c:\company.txt' > dbms='tab' replace; > run; > > where COID='Company ID' > LOCA='Location of the company' > > I want the exported text file with the above labeled > variable names, how > to archieve this? Thanks for all your help! > > Regards, > C.F. Yiu >


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