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

Hello experts, I'm a newbie at programming. I tried using a data step to enter in my data, but when I run the program the last column is blank even though I put values for it. The output is show below:

 

 Patient    Weight    Height    Age      BMI       Smoking     Asthma
                 14         167       70      65     23.95938    never          .
                 9            .       74      64                 never          .
                 4          165       65      25     27.45443    occasion       .
                 2          152       67      60     23.80396    heavy          .
                 13         161       70      77     23.09857    occasion       .
 
 
Here is my code
data exercise1;
input Patient $ Weight Height $ Age $ BMI $ Smoking $ Asthma;
cards;
14 167 70 65 23.9593878 never no
9 . 74 64 . never yes
4 165 65 25 27.4544379 occasionally no
2 152 67 60 23.8039652 heavy smoker yes
13 161 70 77 23.0985714 occasionally yes
1 143 64 55 24.5432129 occasionally no
7 148 71 61 20.6395556 occasionally yes
11 281 69 45 41.4919135 heavy smoker yes
5 220 70 58 31.5632653 occasionally no
6 182 64 26 31.2368164 never no
8 190 66 74 30.6634527 occasionally yes
12 . . 39 . occasionally yes
3 190 69 63 28.0550305 never no
15 148 67 53 23.1775451 never yes
10 152 65 61 25.2913609 never yes
;
title 'Smoking = Heavy Smoker';
proc print noobs;
run;
 
and here is the log:
NOTE: Invalid data for Asthma in line 166 37-38.
166        3   190 69  63  28.0550305  never   no
Patient=3 Weight=190 Height=69 Age=63 BMI=28.05503 Smoking=never Asthma=. _ERROR_=1 _N_=13
NOTE: Invalid data for Asthma in line 167 37-39.
167        15  148 67  53  23.1775451  never   yes
Patient=15 Weight=148 Height=67 Age=53 BMI=23.17754 Smoking=never Asthma=. _ERROR_=1 _N_=14
NOTE: Invalid data for Asthma in line 168 37-39.
168        10  152 65  61  25.2913609  never   yes
Patient=10 Weight=152 Height=65 Age=61 BMI=25.29136 Smoking=never Asthma=. _ERROR_=1 _N_=15
NOTE: The data set WORK.EXERCISE1 has 15 observations and 7 variables.
NOTE: DATA statement used (Total process time):
      real time           0.08 seconds
      cpu time            0.06 second
 
I'm not really sure what to do, please help!

              
1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

You have to declare Asthma to be a character variable.

 

input Patient $ Weight Height $ Age $ BMI $ Smoking $ Asthma $;
--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

You have to declare Asthma to be a character variable.

 

input Patient $ Weight Height $ Age $ BMI $ Smoking $ Asthma $;
--
Paige Miller
user1942
Fluorite | Level 6
thank you!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 2 replies
  • 1149 views
  • 1 like
  • 2 in conversation