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
The first error you get is:
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.
I got that fixed by technical support now I am trying to figure out why the variables and observations still cannot be found unfortunately.
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.);
You are missing all the necessary formats for your variables. Check with the source how you can obtain those formats.
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 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: