Building models with SAS Enterprise Miner, SAS Factory Miner, SAS Visual Data Mining and Machine Learning or just with programming

SAS datalines not reading properly

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 82
Accepted Solution

SAS datalines not reading properly

When I run:

data test

   INFILE DATALINES DSD;

   INFORMAT varname $32.;

   INPUT varname $ var1;

   DATALINES;

"ALPHA",-3.64693629

"BETA1",-0.584778408

"BETA2",-0.808085584

;

run;

Why do I get 3 blank records as output?


Accepted Solutions
Solution
‎07-23-2014 03:58 PM
Contributor
Posts: 28

Re: SAS datalines not reading properly

Also would want to remove blank lines between DATALINES: and ;, as shown below.

DATALINES;

"ALPHA",-3.64693629

"BETA1",-0.584778408

"BETA2",-0.808085584

;

View solution in original post


All Replies
Respected Advisor
Posts: 3,124

Re: SAS datalines not reading properly

cause you missed a semi colon?

data test;

Don't worry, it happened to me millions of time Smiley Happy

Haikuo

Frequent Contributor
Posts: 82

Re: SAS datalines not reading properly

Thanks. I changed the example slightly and it still does not work after putting semi colon.

data test;

   INFILE DATALINES  DSD ;

   INFORMAT varname $32.;

   INPUT varname $ var1 var2 var3;

   DATALINES;

"test",,,1

"test",,624.5,1

"test",624.5,741.5,2

;

run;

Does not work as in only some fields are being read...not all.

Respected Advisor
Posts: 3,124

Re: SAS datalines not reading properly

Works for me:

data test;

INFILE DATALINES  DSD ;

INFORMAT varname $32.;

INPUT varname $ var1 var2 var3;

DATALINES;

"test",,,1

"test",,624.5,1

"test",624.5,741.5,2

;

run;

Capture.PNG

Solution
‎07-23-2014 03:58 PM
Contributor
Posts: 28

Re: SAS datalines not reading properly

Also would want to remove blank lines between DATALINES: and ;, as shown below.

DATALINES;

"ALPHA",-3.64693629

"BETA1",-0.584778408

"BETA2",-0.808085584

;

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 437 views
  • 3 likes
  • 3 in conversation