Date: Fri, 2 Dec 2005 07:34:45 -0500
Reply-To: Wendi Wright <wwright@ETS.ORG>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Wendi Wright <wwright@ETS.ORG>
Subject: Proc Reg with ID Statement and ODS Output
This is a series of emails about a problem that we have not been able to
come up with a solution for. I know this is a long series so I am thanking
anyone who can wade through this to hopefully provide an answer. Do you
know if this might be a bug in SAS or if there is just a simple answer that
we are all missing?
Thanks to all,
Wendi
***************************************************************************
Wendi and Cathy,
Small question with the proc reg.
I am using an ID statement with Proc reg, so ods output
dataset "OutputStatistics" will output the student_id, along with some
other flag variables for each observation.
I have 4 variables in the ID Statement with proc reg.
The format of the 3 of these 4 variables is numeric, the other - character
variable, in the Input Dataset, but when SAS creates this ODS output
dataset "OutputStatistcs", SAS creates these variables in the output
dataset with $8 character format.
I was able to change the formats of these variables after the output
dataset is created by creating a new dataset.
Is there anyway I can preserve/specify the format of these variables in the
ID Statement when SAS creates the ods output dataset.
Thanks and appreciate your help!
Sailesh.
**************************************************************************
Sailesh,
Since the SAS documentation says that it allows 16 characters in the ID
statement, I'm wondering if you have the $8 var as the first in the list?
if so, it's probably setting the size of the "ID". Since the numeric vars
also have length 8, why not try putting a length statement into the
original data set that sets the length of the ID your using?
*** From SAS Documentation Online ***;
ID Statement
ID variables ;
When one of the MODEL statement options CLI, CLM, P, R, or INFLUENCE is
requested, the variables listed in the ID statement are displayed beside
each observation. These variables can be used to identify each observation.
If the ID statement is omitted, the observation number is used to identify
the observations.
Although there are no restrictions on the length of ID variables, PROC REG
may truncate ID values to 16 characters for display purposes.
Cathy
*************************************************************************
I tried running this proc reg without the character variable in the ID
statement.
Also tried changing the order of the variables in the ID statement.
Also tried using a format statement in Proc reg.
The Input dataset was already having different lengths for different
Variables in the ID statement assigned using the length statements.
But, SAS did the same thing again and again and again!, changed the format
of the numeric variables to character variables in the ods output dataset.
I can always fix this by reading the output datasets into new datasets, but
I have to do this 24 times for 24 different datasets. :-(
Please let me know if you could find something that can fix this within
proc reg.
Thanks,
Sailesh.
***************************************************************************
Sailesh,
Why is it a problem that the numeric vars are going to character vars? Are
you merging the sets with something else? The reason this is probably
happening is because, as a rule, ID vars shouldn't be numeric because you
shouldn't be taking a mean, or a standard deviation of this number. I'm
having some trouble with not just letting it go out as character. If it's
a merge issue, consider changing the other data set so that those vars
become character.
I'll see if I can think of anything, but I wish I understood more why it
matters.
Cathy
***************************************************************************
Cathy,
As you predicted, I am merging these datasets with some other datasets.
The variables in the ID statements are fips codes, Book #s, Book Serial #s,
and some other flag.
All the other datasets related to this project I am working on have these
variables as numeric variables, so I would rather process these ods output
datasets in the next datastep to change the format of these variables.
Thanks,
Sailesh