Help using Base SAS procedures

MISSING VALUES WHEN USING@@

Reply
Contributor
Posts: 27

MISSING VALUES WHEN USING@@

What option should be used in the infile statement when @@ is used for raw input data with missing values.Thanks

data ADDEATH1;

label USUBJID  = 'Unique Subject Identifier'

           TRTP       = 'Planned Treatment'

           PARAM     = 'Parameter'

           AVAL       = 'Analysis Value';

PARAM = 'Subject Died';

input USUBJID $ AVAL TRTP $ @@;

datalines;

101 0 a 102 . b 103 1 a 104 . b 105 1 a 106 . b 107 1 a 108 . b

109 1 a 110 1 b 111 1 a 112 1 b 113 0 a 114 0 b 115 1 a 116 0 b

117 1 a 118 0 b 119 1 a 120 1 b 121 1 a 122 1 b 123 1 a 124 1 b

125 1 a 126 0 b 127 1 a 128 0 b 129 1 a 130 0 b 131 1 a 132 1 b

133 1 a 134 1 b 135 1 a 136 1 b 137 1 a 138 1 b 139 1 a 140 1 b

201 0 b 202 1 a 203 0 b 204 0 a 205 1 b 206 0 a 207 1 b 208 1 a

209 1 b 210 1 a 211 1 b 212 1 a 213 0 b 214 1 a 215 0 b 216 0 a

217 1 b 218 0 a 219 1 b 220 1 a 221 1 b 222 1 a 223 1 b 224 1 a

225 0 b 226 1 a 227 0 b 228 0 a 229 1 b 230 0 a 231 1 b 232 1 a

233 1 b 234 1 a 235 1 b 236 1 a 237 0 b 238 1 a 239 0 b 240 0 a

;

run;

Super User
Posts: 10,473

Re: MISSING VALUES WHEN USING@@

It would really depend on your data and since there are a relatively large number of options for INFILE, some of which aren't valid with datalines you may need to be more specific with your need or concern.

Your example runs fine without any additional options.

Note that text variables with list input could be an issue if the missing value is indicated by one or more spaces as they would be ignored with list input.

Contributor
Posts: 27

Re: MISSING VALUES WHEN USING@@

When I execute the program this is my error in log window.

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;

42 ;

43 data ADDEATH;

44 label USUBJID = 'Unique Subject Identifier'

45 TRTP = 'Planned Treatment'

46 PARAM = 'Parameter'

47 AVAL = 'Analysis Value';

48 PARAM = 'Subject Died';

49 input USUBJID $ AVAL TRTP $ @@;

50 datalines;

NOTE: Invalid data for AVAL in line 52 1-63.

RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0 

53 CHAR 117.1.a.118.0.b.119.1.a.120.1.b.121.1.a.122.1.b.123.1.a.124.1.b 

  ZONE 33303060333030603330306033303060333030603330306033303060333030622222222222222222

  NUMR 11791919118909291199191912091929121919191229192912391919124919200000000000000000

NOTE: Invalid data errors for file CARDS occurred outside the printed range.

NOTE: Increase available buffer lines with the INFILE n= option.

USUBJID=101 0 a TRTP=117 1 a PARAM=Subject Died AVAL=. _ERROR_=1 _N_=1

NOTE: Invalid data for AVAL in line 55 1-63.

56 CHAR 201.0.b.202.1.a.203.0.b.204.0.a.205.1.b.206.0.a.207.1.b.208.1.a 

  ZONE 33303060333030603330306033303060333030603330306033303060333030622222222222222222

  NUMR 20190929202919192039092920490919205919292069091920791929208919100000000000000000

NOTE: Invalid data errors for file CARDS occurred outside the printed range.

NOTE: Increase available buffer lines with the INFILE n= option.

USUBJID=125 1 a TRTP=201 0 b PARAM=Subject Died AVAL=. _ERROR_=1 _N_=2

NOTE: Invalid data for AVAL in line 58 1-63.

59 CHAR 225.0.b.226.1.a.227.0.b.228.0.a.229.1.b.230.0.a.231.1.b.232.1.a 

  ZONE 33303060333030603330306033303060333030603330306033303060333030622222222222222222

  NUMR 22590929226919192279092922890919229919292309091923191929232919100000000000000000

NOTE: Invalid data errors for file CARDS occurred outside the printed range.

NOTE: Increase available buffer lines with the INFILE n= option.

USUBJID=209 1 b TRTP=225 0 b PARAM=Subject Died AVAL=. _ERROR_=1 _N_=3

NOTE: LOST CARD.

61 ;

USUBJID=233 1 b TRTP= PARAM=Subject Died AVAL=. _ERROR_=1 _N_=4

NOTE: SAS went to a new line when INPUT statement reached past the end of a line.

NOTE: The data set WORK.ADDEATH has 3 observations and 4 variables.

NOTE: DATA statement used (Total process time):

  real time 0.01 seconds

  cpu time 0.01 seconds

Respected Advisor
Posts: 4,641

Re: MISSING VALUES WHEN USING@@

Your data contains TAB characters on some lines. Try adding the statement INFILE DATALINES EXPANDTABS; to your datastep. - PG

PG
Ask a Question
Discussion stats
  • 3 replies
  • 208 views
  • 0 likes
  • 3 in conversation