Hello,
In the table shown I use proc mean and I want when the field number_card =7777 the record will be taken into account but will not be counted in the number of records.
For example in this table, the proc mean will be count 4 records.
Is it possible?
table:
bank | branch | number_card | group | company |
20 | 1 | 33378789 | 2 | 22 |
20 | 1 | 33335345 | 3 | 31 |
20 | 1 | 7777 | 5 | 51 |
20 | 2 | 44454534 | 2 | 22 |
20 | 2 | 7777 | 3 | 31 |
20 | 2 | 44434535 | 5 | 51 |
Proc Means Data=SASHelp.cars;
class branch;
Var group;
Run;
And I'll get something like that:
branch | N Obs | group |
1 | 1 | 2 |
1 | 1 | 3 |
1 | 0 | 5 |
2 | 1 | 2 |
2 | 0 | 3 |
2 | 1 | 5 |
Thanks.
Sounds like you just want to add a WHERE statement to exclude those observations.
Clearly your dataset is not named SASHELP.CARS. Let's assume it is named HAVE instead.
Do you want the MEAN of GROUP? That doesn't make much sense unless the GROUP variable has the number of people in the group? Looks more like you want to use GROUP as another CLASS variable.
Assuming number_card is a character variable then the code could look like:
proc means data=HAVE ;
where number_card ne '7777';
class branch group;
run;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.