- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello Friends
I have code like this below: When I tried to run I get an error. Can you please tell me whether is there issue with this code?
data test3;
input name $ age salary informat comma9.;
datalines;
john 35 $3,500.00
Jodi 43 $2,850.00
Noel 45 $4,200.00
;
run;
Thanks you very much
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
From now on, please don't tell us there's an error, and then not tell us what the error is. When there is an error, show us the log or show us (and explain) the incorrect output.
I think you want this:
data test3;
input name $ age salary comma9.;
datalines;
john 35 $3,500.00
Jodi 43 $2,850.00
Noel 45 $4,200.00
;
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
From now on, please don't tell us there's an error, and then not tell us what the error is. When there is an error, show us the log or show us (and explain) the incorrect output.
I think you want this:
data test3;
input name $ age salary comma9.;
datalines;
john 35 $3,500.00
Jodi 43 $2,850.00
Noel 45 $4,200.00
;
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Miller. This is the log when I run the query.
108 data test3;
109 input name $ age salary informat comma9.;
110 datalines;
NOTE: Invalid data for salary in line 112 9-17.
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----
112 john 35 $3,500.00
name=john age=35 salary=. informat=. _ERROR_=1 _N_=1
NOTE: Invalid data for salary in line 113 9-17.
113 Jodi 43 $2,850.00
name=Jodi age=43 salary=. informat=. _ERROR_=1 _N_=2
NOTE: Invalid data for salary in line 114 9-17.
114 Noel 45 $4,200.00
name=Noel age=45 salary=. informat=. _ERROR_=1 _N_=3
NOTE: SAS went to a new line when INPUT statement reached past the end of a line.
NOTE: The data set WORK.TEST3 has 3 observations and 4 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
115 ;
116 run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks it is working as per your code below:
data test3;
input name $ age salary comma9.;
datalines;
john 35 $3,500.00
Jodi 43 $2,850.00
Noel 45 $4,200.00
;
run;
proc print data=test3;
informat salary comma9.;
run;