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 (January 2006, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 30 Jan 2006 18:11:57 -0500
Reply-To:     "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject:      Re: Proc export - Customize decimal places

On Sun, 29 Jan 2006 19:58:57 -0800, Hari <excel_hari@YAHOO.COM> wrote:

>Hi, > >When I look up the log for Proc Export for my above problem then I get >the following (I changed only the variable names and the number of >variables. Also , I dont want to write out the variable names in my >outfile so removed that loop. Othe than these changes I have not >tampered with the code below.) > >data _null_; > set &FinalHBRegData end=EFIEOD; > %let _EFIERR_ = 0; /* set the ERROR detection macro variable */ > %let _EFIREC_ = 0; /* clear export record count macro variable >*/ > file '&ProjectRootFolderPath.\Working\Exported files\2006 01 >30\&FinalHBRegData..csv' >delimiter=',' DSD DROPOVER lrecl=32767; > format InterCeptDumm best12. ; > format IndepVar1 best12. ; > format IndepVar2 best12. ; > format IndepVar3 best12. ; > format IndepVar4 best12. ; > format DepenVar best12. ; > do; > EFIOUT + 1; > put InterCeptDumm @; > put IndepVar1 @; > put IndepVar2 @; > put IndepVar3 @; > put IndepVar4 @; > put DepenVar @; > ; > end; > if _ERROR_ then call symputx('_EFIERR_',1); /* set ERROR detection >macro variable */ > if EFIEOD then call symputx('_EFIREC_',EFIOUT); > run; > > >I want to store the write-out format for my numeric variables >(IndepVar1 to DepenVar with number of decimal places as 2. I dont know >how to control that. The widths of different numeric variables are >quite different for example, InterceptDumm (Stands for value of >Intercept which is always 1) has width as 1 and the IndepVar1/IndepVar2 >has maximum of value 9999 and number of decimal places varying from one >row to another (as seen from data file view). Similarly other 3 >variables IndepVar3, IndepVar4 and DepenVar hav maximum values as lets >say a six digit number. In short how do I customize my above variables >to have

This seems pretty straightforward; just use the appropriate w.d format for each variable. If I understand, d will always be 2.

> >Also, the PUT statement in Log of Proc Export shows that it is writing >out my number kind of variables as String (@) Why is this happening? I >can understand such kind of problems happening in case of Proc Import >but why should it happen while exporting?

The at (@) sign tells SAS to hold the buffer so that it can write some more on the same line. It is not bound to any preceding variable name and has nothing to do with data types (numeric vs. character). Maybe you are confusing it with the dollar($) sign.

> >Just to add am facing one more problem. When I try to read in numerical >data from output of another software then SAS is reading it as String >(My first 20 rows of that variable is missing). K , I can probably >overcome this by using the Log of Proc Import, but am concerned that >even when I dont have string data in any of my variables (string used >to get truncated while using Proc Import), then am forced to use the >Log of proc Import.

You are using a DATA step, and DATA steps can be crafted to do just about anything in this vein. The fact that you are developing your DATA step by tweaking one generated by the PROC, instead of coding from scratch, is very much secondary.

Problems with PROC IMPORT or the Import Wizard are never-ending on this list. If those things work for you, you are lucky. Otherwise leave them behind and be glad that SAS has more versatile tools.

> >Regards, >Hari >India

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