BookmarkSubscribeRSS Feed
eag14
Calcite | Level 5

I am trying to rerun an old glm model (MANOVA) with code that works in SAS 9.4 but is not working in SAS Studio.  Again, this exact code works in older versions of SAS but not this one.  I think it may be the data I am inputting that is not getting read correctly, but I don't know what the problem is.  Any help is much appreciated!  I've attached the original text file with codes as well as screenshots of the output and error messages.  Thanks so much!

 

Eric

ericgriffin742@gmail.com

6 REPLIES 6
eag14
Calcite | Level 5
Thanks so much for your quick reply.  Unfortunately, that still did not work.  I attached the new code txt file as well as the error messages.  
 
It says "statement not valid or it is used out of proper order."  I should put this code right before the data, correct?
 
Later it also says "NODATALINES or INFILE statements" (screenshots attached). 
 
Thanks so much again!
 
Eric
eag14
Calcite | Level 5

Hi everyone,

 

I am trying to rerun an old glm model (MANOVA) with code that works in SAS 9.4 but is not working in SAS Studio.  Again, this exact code works in older versions of SAS but not this one.  I think it may be the data I am inputting that is not getting read correctly, but I don't know what the problem is.  Any help is much appreciated!  I've attached the original text file with codes as well as screenshots of the output and error messages.  Thanks so much!

 

Eric

ericgriffin742@gmail.com

 

 

eag14
Calcite | Level 5

I'm not sure whether this page is relevant to my question, but could the problem be that my data are separated by spaces rather than tabs?

https://communities.sas.com/t5/SAS-Programming/Tab-delimiter-error-with-Datalines/td-p/302748

 

-Eric ric

Tom
Super User Tom
Super User

The first step in your program is reading the data into a dataset.

Get that working first.  Then you can work on the actual GLM code.

The problem might be that some editor you used as inserted tabs into your file. (40 years ago editors used to replace spaces with tabs to help save bytes in the documents. A single tab character could replace 2 to 8 space characters.)  In SAS Display Manager it would happily replace the tabs with spaces before sending the code to run.  But in SAS/Studio it does not provide this service for you and actual tab characters in program files end up being part of the source that SAS reads.

Try telling SAS to expand the tabs in your data lines.

data want;
  infile datalines expandtabs;
  input ...
datalines;
....
;;;;

Or perhaps just save the lines of data to a separate file and have the data step read from that.

data want;
  infile 'myfile.txt' expandtabs ;
  input .... ;
run;
eag14
Calcite | Level 5

Great, this was really helpful.  The model is working now!

 

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 1911 views
  • 4 likes
  • 3 in conversation