a month ago
I'm trying to create a new variable for my dataset that uses proportions from other variables.
I created a variable for the mean level of compliance in each room (room_complianceMEAN) in a separate dataset but cannot merge the sets back onto the main set and room_name. I'm using SAS 9.4
I’m trying to:
1. total the number of observations where a certain dispenser is used for a room
where dispensing_sensor_name = “sensor name” and room_name =“room name”;
2. create a variable that acts as the proportion of uses in that room to the total number of use in that room
3. add these variables to the dataset so they can be used along with others in a model
use_proportion, room_rank, worker_type, floor, intervention, etc.
PROC MEANS data = hh7;
OUTPUT OUT=room_complianceMEAN MEAN= /AUTONAME;
proc print data = room_complianceMEAN;
PROC freq data = hh7;
where compliant =1;
proc print data =room_USEPROPORTION;
proc freq data = hh7;
where room_name="Room 7108-9";
tables dispensing_sensor_name*compliant /missing;
a month ago
Since you didn't explain, let me ask why do you say "cannot merge the sets back onto the main set and room_name"?
Show us your SASLOG.
Show us a portion of your data, following these instructions: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat...