BookmarkSubscribeRSS Feed
jeboltz
Fluorite | Level 6

Trying to figure out why my SAS studio and my SAS 9.4 at work are giving me different results on the same data.

 

basically, I have the same excel file of data uploaded to both, same code renaming variables and subsetting the information, same everything except the SAS platform. Yet the resulting data subset in SAS 9.4 is 1571 observations, and in studio 1576.

 

has anyone else run into this? the only thing I can think of is you can't use the same code language in both....?

5 REPLIES 5
ChrisHemedinger
Community Manager

Can you post the code and different logs that you're seeing?

 

Any chance that the import settings are different so you have a different number of records to start with?

 

Check also system options that affect overall behavior, like VALIDVARNAME.

Learn from the Experts! Check out the huge catalog of free sessions in the Ask the Expert webinar series.
jeboltz
Fluorite | Level 6

of course.

 

Here's the code for the subsetting, where STItestALL is a dichotomous variable (made sure there's no missing) and then I don't want any observations with a missing entry for the variable of sex.

 


data DRsubset;
set DRdata;
if STItestALL = "Yes" or STItestALL = "No";
if sex ^= .;
run;

 

the log for 9.4 is the following:

434
435  data DRsubset;
436  set DRdata;
437  if STItestALL = "Yes" or STItestALL = "No";
438  if sex ^= .;
439  run;

NOTE: There were 1602 observations read from the data set WORK.DRDATA.
NOTE: The data set WORK.DRSUBSET has 1571 observations and 365 variables.
NOTE: DATA statement used (Total process time):
      real time           0.04 seconds
      cpu time            0.03 seconds

 

and the log for studio is the following:

 

448 data DRsubset;
449 set WORK.DRdata;
450 if STItestALL = "Yes" or STItestALL = "No";
451 if sex ^= .;
452 run;
 
NOTE: There were 1602 observations read from the data set WORK.DRDATA.
NOTE: The data set WORK.DRSUBSET has 1576 observations and 368 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
user cpu time 0.01 seconds
system cpu time 0.01 seconds
memory 3914.93k
OS Memory 33704.00k
Timestamp 10/26/2017 10:52:48 PM
Step Count 124 Switch Count 2
Page Faults 0
Page Reclaims 611
Page Swaps 0
Voluntary Context Switches 13
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 9736
 
I also just noticed I somehow end up with 3 extra variables.
 
I'll give the VALIDVARNAME a shot.
ChrisHemedinger
Community Manager

Now I'm suspicious of the methods of import.  Both using PROC IMPORT? And the same DBMS= method (I recommend DBMS=XLSX)?

Learn from the Experts! Check out the huge catalog of free sessions in the Ask the Expert webinar series.
Tom
Super User Tom
Super User

I would first try to find where the three extra variables came from.

Usually that is sign of a misspelled variable name or missing semi-colon that causes the code result in new variables being created.

Reeza
Super User

What's the earliest stage where the results differ?

Check the Import first and work down from there....or start in the middle if they match move down the code.

 

SAS Studio (at least UE) seems a bit weird with how it imports Excel files and the names, it doesn't list them in the viewer if it's using VALIDVARNAME=ANY so I generally change that to V7 myself.  I think yesterday was the first time I came across this so far though. 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 4049 views
  • 0 likes
  • 4 in conversation