BookmarkSubscribeRSS Feed
Tisha1997
Calcite | Level 5
LIBNAME Mydata "C:\Users\tisha\Downloads\NSCH2019_SAS_CAHMI_DRC";
RUN;
proc contents data=Mydata.Nsch2019;
run;

Data Mydata;
Set Mydata.Nsch2019;
Run;

INSTY = InsType_19*1;
FORGON = nom25ForgoneHC_19*1;
SC_AGE_YEARS_L = SC_AGE_YEARS*1;
SC_SEX_L = SC_Sex*1;
SC_HISPANIC_R_L = SC_HISPANIC_R*1;
SC_RACE_R_L = SC_RACE_R*1;
FPL_I1_L = FPL_I1*1;
EDUCFO = AdultEduc_19*1;
INSURAN = npm15AdIns_19*1;
SYSTCAR = SystCare2_19*1;
NOGAP = InsGap_19*1;
run;

Proc logistic data = Nsch.Nsch2019;
class SC_AGE_YEARS (ref = '1')/ param = ref;
model nom25ForgoneHC_19 = SC_AGE_YEARS /link = logit;
run;

Shown in the results there are observations and variables available but when I run my code the only thing that come available is the variables. Also, I am changing my variables within the dataset from categorical to numerical but it seem to not be able to find my formats

4 REPLIES 4
Patrick
Opal | Level 21

The first error you get is:

Patrick_0-1636003288878.png

Don't even look further before you haven't fixed this one. It looks like your SAS profile is corrupted. 

 

If this is a personal installation then terminate your SAS session, go to the folder libref SASUSER points to, backup the folder, delete all its content and then try again running your SAS code.

 

If this is not your personal installation then contact your SAS administrator.

Tisha1997
Calcite | Level 5

I got that fixed by technical support now I am trying to figure out why the variables and observations still cannot be found unfortunately.

ballardw
Super User

Without even opening your log:

Data Mydata;
Set Mydata.Nsch2019;
Run;

INSTY = InsType_19*1;
FORGON = nom25ForgoneHC_19*1;
SC_AGE_YEARS_L = SC_AGE_YEARS*1;
SC_SEX_L = SC_Sex*1;
SC_HISPANIC_R_L = SC_HISPANIC_R*1;
SC_RACE_R_L = SC_RACE_R*1;
FPL_I1_L = FPL_I1*1;
EDUCFO = AdultEduc_19*1;
INSURAN = npm15AdIns_19*1;
SYSTCAR = SystCare2_19*1;
NOGAP = InsGap_19*1;
run; 

The highlighted RUN will cause errors for the next assignment statements because you have ended the Data step and the next statements until the "run" do not have a procedure or data step to be associated with. So your Mydata set only copied the Mydata.Nsc2019 data set and had none of the transformations or variable creations applied.

 

If all of those *1 are to create numeric variables strongly suggest using the INPUT function instead to avoid all the "character values were converted to numeric" notes in the log. For an example:

INSTY = input (InsType_19, f12.);

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1966 views
  • 3 likes
  • 4 in conversation