Hello,
I would like to filter the below data produced by Proc Freq between dates. My where statement below isn't working. Help
Title 'BSC Member_Bis Counts';
proc freq data=&Project..enrollment_bis_final_collapsed;
format mctr_based_prod_id $Product.;
ods output onewayfreqs=BSC_Enrollment_Count;
tables mctr_based_prod_id;
WHERE t1.TerminationDate BETWEEN &Term_st. AND &Term_ed.;
run;
Title;
Using "isn't working" as your total description of a problem just .. "doesn't work".
What did you get vs what you expected? Were there any error message on your sas log? What does the log report?
If the log provided no error messages, what erroneous output did the PROC FREQ produce?
@Jesusismygrace wrote:
Hello,
I would like to filter the below data produced by Proc Freq between dates. My where statement below isn't working. Help
Title 'BSC Member_Bis Counts';
proc freq data=&Project..enrollment_bis_final_collapsed;
format mctr_based_prod_id $Product.;
ods output onewayfreqs=BSC_Enrollment_Count;
tables mctr_based_prod_id;
WHERE t1.TerminationDate BETWEEN &Term_st. AND &Term_ed.;
run;
Title;
If TerminationDate is a variable in &Project..enrollment_bis_final_collapsed then you do not use T1. notation. You should show your log with the error and the code and paste into a text box opened on the forum with the </> icon.
Since you do not show assignments for ANY of the macro variables can't tell if they are appropriate or not.
Such as :
272 proc freq data=sashelp.class; 273 where t1.sex in ('F' 'M'); ------ 180 ERROR: Syntax error while parsing WHERE clause. ERROR 180-322: Statement is not valid or it is used out of proper order. 274 run;
Dot notation in the middle of a procedure except in very few cases is right out. You would be wrong to include any reference to a data set as once you have a data set on the Proc statement that is the source of all variables.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.