BookmarkSubscribeRSS Feed
Obsidian | Level 7

I am trying to analyze a 2-way factorial RCBD using ANOVA. I have set a PROC IMPORT command from an excel file. One of the variables is Gas, of which Methane, Nitrous Oxide and Carbon Dioxide are options. I want to analyze the data by gas. I wanted to look at Methane first, so, folowing after the PROC IMPORT command i inserted:

data Jul14_1;
set import;

if Gas=Methane;


This is followed by PROC SORT, PROC PRINT, and PROC ANOVA commands. Although the Log does not show any errors, the prinout does not include any statistical results just the input data. The log gives one comment in blue: "NOTE: Variable Methane is uninitialized." and anotoher in green: "WARNING: Data set WORK.JUL14_1 was not replaced because new file is incomplete."


How do i properly use a command for SAS to only analyze the methane data from the imported excel file?



Super User

The error is here, SAS is looking for a variable Methane. If you're trying to specify a string, you enclose it in quotation marks.

"NOTE: Variable Methane is uninitialized."


if gas='Methane';

You can also implement the filter directly in your proc using a WHERE clause. 


where gas='Methane';


Also, if you're going to do the same analysis for all gas types use a BY variable instead of filtering and running for each type.

Obsidian | Level 7

Yup, that worked. Thanks.



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg



Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1 like
  • 2 in conversation