BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
robertrao
Quartz | Level 8

Hi,

Could you help me figure out why I am getting this note??? after using the following lines of code???

  Also can I use the code like this????

  872 if Admission=0 and intck('year',Birth_Date2,ADMIT_DATE1) gt 1 then AgeAtAdmission=intck('year',Birth_Date2,ADMIT_DATE1);

  873 if intck('year',Birth_Date2,ADMIT_DATE1) lt 1 then AGEDAY=ADMIT_DATE1-Birth_Date2;

NOTE: Missing values were generated as a result of performing an operation on missing values.

Each place is given by: (Number of times) at (Line):(Column).

65 at 873:4    65 at 873:70

NOTE: There were 14178 observations read from the data set WORK.FINAL.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
BartDekeyser
Calcite | Level 5

this is it :

data test;

informat Birth_Date2 Admit_date1 date9.;

format Birth_Date2 Admit_date1 date9.;

input Admission Birth_Date2 Admit_Date1;

var1 = intck('Year' , BirthDate2, Admit_Date1);

if Admission = 0 and var1 > 1 then AgeAtAdmission = var1;

else AgeDay = intck('day', BirthDate2,  Admit_date1);

drop var1;

cards;

1 15apr1980 .

0 15apr1980 20jun1985

0 10jul2000 22aug2010

0 15may2010 15jun2010

;

run:

View solution in original post

7 REPLIES 7
ballardw
Super User

You have missing values for some of either Birth_Date2, Admit_Date1 or both. Run Proc Freq on those variables and see how many of each.

mohamed_zaki
Barite | Level 11

This note let you know about the missing values that were created.

for example check this 4. Missing values in assignment statements . It give you an example with details about this note.

art297
Opal | Level 21

If you're only going to have an admit_date1 if someone has a value of 0 for admission then you have to account for that fact.

My question: why calculate two different variables for those above and below 1 year old when you could capture both with something like:

data have;

  informat Birth_Date2 ADMIT_DATE1 date9.;

  format Birth_Date2 ADMIT_DATE1 date9.;

  input Admission Birth_Date2 ADMIT_DATE1;

  if admission eq 0 then AgeAtAdmission=YRDIF(Birth_Date2,ADMIT_DATE1,'age');

  cards;

1 15apr1980 .

0 15apr1980 20jun1985

0 10jul2000 22aug2010

0 15may2010 15jun2010

;

robertrao
Quartz | Level 8

Hi Art,

Thanks for the help.

The sas code requires the input file to have the new variable(ageday) created if age is less than an year.

I now understand that the "note" is because of some missing dates....

Is there any better way to recode the following.

872      if Admission=0 and intck('year',Birth_Date2,ADMIT_DATE1) gt 1 then AgeAtAdmission=intck     ('year',Birth_Date2,ADMIT_DATE1);

873 if intck('year',Birth_Date2,ADMIT_DATE1) lt 1 then AGEDAY=ADMIT_DATE1-Birth_Date2;

Thanks

BartDekeyser
Calcite | Level 5

You should put

intck('year',Birth_Date2,ADMIT_DATE1)

in a variable (so sas doesn't have to calculate 3 times the same thing + it reads better)

fe.

var1 = intck('year',Birth_Date2,ADMIT_DATE1);

if var1 > 1 then AgeAtAdmission = var1;

else  AgeDay = intck('day', ADMIT_DAT, Birth_Date2);

robertrao
Quartz | Level 8

Thanks Bart,

For helping me use the code efficiently.

I also wanted to know if the result would be the same both ways(with what u showed and what I have done prior)

Thanks

BartDekeyser
Calcite | Level 5

this is it :

data test;

informat Birth_Date2 Admit_date1 date9.;

format Birth_Date2 Admit_date1 date9.;

input Admission Birth_Date2 Admit_Date1;

var1 = intck('Year' , BirthDate2, Admit_Date1);

if Admission = 0 and var1 > 1 then AgeAtAdmission = var1;

else AgeDay = intck('day', BirthDate2,  Admit_date1);

drop var1;

cards;

1 15apr1980 .

0 15apr1980 20jun1985

0 10jul2000 22aug2010

0 15may2010 15jun2010

;

run:

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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
  • 7 replies
  • 793 views
  • 6 likes
  • 5 in conversation