08-17-2016 01:17 PM - last edited on 08-17-2016 02:47 PM by PGStats
When changing the name of a dataset using a datastep to further manipulate the dataset, I see that some of the variables pos have changed. This results in some of the values shifting to the wrong variables.
How can I prevent changes other than the dataset's name when performing the following steps?
08-17-2016 02:00 PM
Here is a screen shot of the dataset before and after the datastep. A value seems to be appear in the first collumn. Below are the output of the Proc Contents for the two datasets. Note how the position changes for some variables.
LAB1 Proc Contents
BIOMEDIC Proc Contents:
08-17-2016 03:18 PM
My original file might be carrying some value from previous manipulations (ex, Retain), hidden values, or be corrupted. I have no idea. Thanks for confirming this is abnormal.
That doesn't make sense.
If the code is as shown, with no retain or any other process in between the position in the buffer shouldn't change. Note that your variable order is staying the same.
Can you post the code that causes including the proc contents before and after?
If you can replicate it I would contact SAS Tech Support.
Not sure what version your on, but In SAS 9.4 POS isn't even included in the output from proc contents, there's a NPOS though.
08-17-2016 03:38 PM
Someone else created the file i'm working on. I don't know what specific manipulations were done before it got to me.
Those don't matter, they're not maintained with the dataset.
What matters is what you're doing. Are you seeing a note in log? About CEDA access perhaps?
Please post the code and log.
08-17-2016 03:43 PM
6635 DATA SAS.BIOMEDIC;
6636 SET SAS.LAB1;
NOTE: 51588 observations were read from "SAS.LAB1"
NOTE: Data set "SAS.BIOMEDIC" has 51588 observation(s) and 32 variable(s)
NOTE: The data step took :
real time : 0.118
cpu time : 0.109
6638 quit; run;
6639 ODS _ALL_ CLOSE;
08-17-2016 03:46 PM
POS -> Position in Buffer
NUMBER -> Position in Dataset
This results in some of the values shifting to the wrong variables.
According to Proc Compare output all variables and values are identical.
Personally, I don't see an issue. If you want to understand why the location in the buffer has changed it could be as simple as you're writing the data to a different system. I would consider asking tech support for an answer if interested, but given everything provided the change in POS should not impact your work.
08-17-2016 03:20 PM
Please run the compare procedure:
Proc compare data=LAB1 compare=BIOMEDIC;
Look at the output of this procedure. Are there unequal values ?
If you don't understand the output report, post it and I shall try to clarify it.
You should not be aware of changes in posions of variables, as long as all observations are equal.
08-17-2016 03:53 PM
The PROC COMPARE proves that the 2 datasets are identical as far as column names and values are concerned which is what you would expect. It doesn't explain the change in column positions.
08-17-2016 03:53 PM
Clarification of results:
You got the note thal all observations are duplicate, that is because I_LABIM_KITID is not a unique key.
Change the ID line and add the other key varables in a format of: ID key1 key2 key3 ... ;
You got also the message "Nomber of Observations with Some Compared Variables Unequal = 0" and
"Nomber of Observations with All Compared Variables Equal = 51588" which is the whole dataset.
Those 2 messages are the proof that the 2 datasets are equal by values.
08-17-2016 04:28 PM
I tried Proc Compare with different KeyIDs. I thought this would not work as the KeyID values are different in the two datasets (as displayed to me) but it appears SAS still sees them as the same regardless.
So I reckon the two datasets are "technically" the same. So I guess this is something related to the display and my system.
I reckon the two datasets are "technically" the same. So I guess this is something related to the display provided by my system.