SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

SAS HLO= O not working as expected

Reply
Frequent Contributor
Posts: 82

SAS HLO= O not working as expected

I am creating a data step as follows:

data TEST;

   INFILE DATALINES DSD;

   INPUT  CODE: $4. FLAG_IND: $1.;

   DATALINES;

0111,Y

0115,N

;

if last then do;

hlo ='O';

FLAG_IND ='U';

output;

end;

run;

My desired output is:

CODE    FLAG_IND   HLO

0111        Y

0115        N

               U                O

But I get:

Statement is not valid or it is used out of proper order.

Is my syntax not right? I was following this:

http://www.pharmasug.org/proceedings/2011/CC/PharmaSUG-2011-CC19.pdf

Page 2

Super User
Posts: 10,527

Re: SAS HLO= O not working as expected

The log should be pointing to this line for the error:

if last then do;

Firstly, code precedes the datalines statement.

Second the example uses the END= option for reading a dataset which is not available for DATALINES.

Example:

set Med_tmp end = last;

To use the End option first read the dataset and then use the code from the example on the SET statement reading the set just created.

Or read the data from an external file and use the End=last  option on the INFILE statement.

Ask a Question
Discussion stats
  • 1 reply
  • 352 views
  • 0 likes
  • 2 in conversation