I am receiving the error that says the class variable has more than two levels, but i am pretty sure i only have two. Please help.
PROC IMPORT DATAFILE=REFFILE
DBMS=CSV
OUT=WORK.IMPORT;
GETNAMES=YES;
RUN;
PROC CONTENTS DATA=WORK.IMPORT; RUN;
%web_open_table(WORK.IMPORT);
DATA IMPORT;
infile '/folders/myfolders/sasuser.v94/nyc-rolling-sales.csv';
INPUT NEIGHBORHOOD $ Sales_Price;
proc ttest;
class neighborhood; /* defines the grouping variable */
var sales_price; /* variable whose means will be compared */
run;
... then use
proc ttest data=import;
/* Neighborhoods values to be compared */
where neighborhood in ("First value", "Second value");
class neighborhood;
var sales_price; /* variable whose means will be compared */
run;
to compare the levels of interest.
Run this to confirm how many levels:
proc freq;
table neighborhood / missing;
run;
... then use
proc ttest data=import;
/* Neighborhoods values to be compared */
where neighborhood in ("First value", "Second value");
class neighborhood;
var sales_price; /* variable whose means will be compared */
run;
to compare the levels of interest.
I am getting the same error. I am having trouble posting my question. Why do I keep getting the error "the class variable has more than two levels"?
My code:
data name;
input one two @@;
cards;
16.03 16.02 16.04 15.97 16.05 15.96 16.05 16.01 16.02 15.99
16.01 16.03 15.96 16.04 15.98 16.02 16.02 16.01 15.99 16.00
;
proc ttest data=name;
class one;
var two;
run;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: