BookmarkSubscribeRSS Feed
stancemcgraw
Obsidian | Level 7

I am trying to create a new variable from an exisitng one, but whenever I try, it says variable uninitialized. What is the problem?

 

libname Iat '\\vmware-host\Shared Folders\Desktop\SAS\IAT\';

 

PROC IMPORT OUT= X.X

            DATAFILE= 'timetoiat'

            DBMS=CSV REPLACE;

     GETNAMES=YES;

GUESSINGROWS=X;

     DATAROW=X; 

 

 

RUN;

 

 

proc import datafile="\\vmware-host\Shared Folders\Desktop\SAS\IAT\timetoiat"

out=Iat.timetoiat dbms=xlsx replace; 

sheet="Sheet1"

getnames=yes; 

 

run;

 

Data iat;

set iat.timetoiat;

IF NIHSS LE 16 THEN NIHSS=NIHSSLT16;

IF NIHSS >=16 THEN NIHSS=NIHSSGTE16;

RUN;

 

log:

20       Data iat;

21       set iat.timetoiat;

22       IF NIHSS LE 16 THEN NIHSS=NIHSSLT16;

23       IF NIHSS >=16 THEN NIHSS=NIHSSGTE16;

24       RUN;

 

NOTE: Variable NIHSSLT16 is uninitialized.

NOTE: Variable NIHSSGTE16 is uninitialized.

NOTE: There were 380 observations read from the data set IAT.TIMETOIAT.

NOTE: The data set WORK.IAT has 380 observations and 24 variables.

NOTE: DATA statement used (Total process time):

      real time           0.03 seconds

      cpu time            0.01 seconds

 

4 REPLIES 4
Reeza
Super User

The error message is pretty clear. 

Run a proc contents to check your variable names are correct. 

Astounding
PROC Star

Which variable are you trying to create?  This code is trying to replace NIHISS.  It doesn't create anything new.

Kurt_Bremser
Super User
20       Data iat;
21       set iat.timetoiat;
22       IF NIHSS LE 16 THEN NIHSS=NIHSSLT16;
23       IF NIHSS >=16 THEN NIHSS=NIHSSGTE16;
24       RUN;

NOTE: Variable NIHSSLT16 is uninitialized.
NOTE: Variable NIHSSGTE16 is uninitialized.

this simply means that there are no variables NIHSSLT16 and NIHSSGTE16 in dataset iat.timetoiat.

 

Have a look at your infile you use in PROC IMPORT. I also noted that you import into library LAT, but use IAT.timetoiat in your DATA step.

cici0017
SAS Employee

Your previous code is replacing the value of NIHSS but not created variables NIHSSLT16 and NIHSSGTE16, you should have code:

 

Data iat;
  set iat.timetoiat;
   IF NIHSS LE 16 THEN NIHSSLT16=NIHSS;
   IF NIHSS >=16 THEN NIHSSGTE16=NIHSS;
  RUN;

 

 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 2075 views
  • 0 likes
  • 5 in conversation