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;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.