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 (July 2004, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 16 Jul 2004 17:55:38 -0400
Reply-To:   Peter Crawford <peter.crawford@BLUEYONDER.CO.UK>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Peter Crawford <peter.crawford@BLUEYONDER.CO.UK>
Subject:   Re: Format question
Comments:   To: david Fickbohm <DavidF@HOMEGAIN.COM>

On Fri, 16 Jul 2004 09:26:44 -0700, David Fickbohm <DavidF@HOMEGAIN.COM> wrote:

>People, >I have a field that contains the number 1 through 5 representing different >purposes for entering a website. I think I am correct in saying that if I >use a format to show a word instead of a number in that field the field will >still have a number when I export the final dataset to excel. Am I correct >? I think the only way to actually show the word is to use an if and add a >new variable to the dataset if x = 1 then "word" > >Am I correct ? > >Thanks >Dave > >Dave Fickbohm >Data Mining Analyst >Homegain+ >2450 45th St. >Emeryville, CA, 94608 >Phone 510 655 0800 ext 4151

Hi Dave, this is one reason I prefer to avoid the proc export The alternative is a fairly simple datastep... unless you have a lot of variables, when the sql prefix helps

The data step data _null_; file 'your.csv.file.csv' lrecl=30000 dsd ; put 'var1,var2,var3,........lastVar'; ***see below; do while( not eof) ; set your_data_set end=eof ; put (_all_)(~); end; run; *** Only at that marked line do you need to put any var names. They should be in order, separated by commas ; If you have too many variables to list like this, you can get sql to generate the list for you..... like: proc sql noprint; select quote(trim(name)) into :names_head separated by "," from dictionary.columns where libname = "%upcase(your_lib_name)" & memname = "%upcase(your_mem_name)" order by varnum ; quit;

After that, the ***marked line would be put &names_head ;

With this method, all default formats in your data would be respected, when the csv file is created.

good luck Peter Crawford


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