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;
run;
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?
Thanks
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.
Yup, that worked. Thanks.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.