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

Hello

In following example there are 2 missing values in  observation2 and 1 missing value in observation1.

There are 5 observations.

SAS fail to read it correctly.

May anyone correct the code below and explain

 

data weight3;     
infile datalines missover;   
input IDnumber $ Week1 Week16;    
WeightLoss2=Week1-Week16;        
cards;              
2477 195  163
2431 
2456 173  155
2412 135  116
     148  143
; 
Run;
1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

Add an exact pointer to the IDNumber variable like this

 

data weight3;     
infile datalines missover;   
input IDnumber $ 1-4 Week1 Week16;    
WeightLoss2=Week1-Week16;        
cards;              
2477 195  163
2431 
2456 173  155
2412 135  116
     148  143
; 
Run;

View solution in original post

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

Add an exact pointer to the IDNumber variable like this

 

data weight3;     
infile datalines missover;   
input IDnumber $ 1-4 Week1 Week16;    
WeightLoss2=Week1-Week16;        
cards;              
2477 195  163
2431 
2456 173  155
2412 135  116
     148  143
; 
Run;
singhsahab
Lapis Lazuli | Level 10

data weight3;
input IDnumber $ 1-4 Week1 6-8 Week16 11-13;
WeightLoss2=Week1-Week16;
cards;
2477 195 163
2431
2456 173 155
2412 135 116
148 143
;
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
  • 2 replies
  • 1326 views
  • 2 likes
  • 3 in conversation