/* Frequuency for Prices100 */
proc freq data=AddnewPrice;
TABLES Gender*Prices100
/chisq;
where Prices100 = "RM201-RM400";
run;
What is wrong with the code you show us?
You may want to describe what you are attempting and what you mean by "specfic variable"
I know that you likely don't like that your Log shows something like:
NOTE: No statistics are computed for Gender * Prices100 because Prices100 has less than 2 nonmissing levels.
You have restricted one of the variables to only allow one level, "RM101-RM400", and when you have a two-way chi-square the calculations just do not work that way as you are introducing a divide-by-zero condition.
You can run a chi-square on a single variable such as:
Proc freq data=sashelp.class; tables age /chisq; run;
And the results reflect the levels of the single variable.
I suspect that you may have wanted if the question you wanted answered was "is the distribution of Gender the same/different when Prices100 has this specific value".
proc freq data=AddnewPrice; TABLES Gender /chisq; where Prices100 = "RM201-RM400"; run;
@ChingYee wrote:
/* Frequuency for Prices100 */
proc freq data=AddnewPrice;
TABLES Gender*Prices100
/chisq;
where Prices100 = "RM201-RM400";
run;
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!
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.