Hello I am currently learning SAS and working on a problem as follows:
Below are the Gender and JObcode freq distributions:
I generated a freq count(crosstab) of gender by jobcode and got this table
I get what I see, but I am wondering how SAS determines the numbers from the above two tables. I mean the gender table is not having any job codes and the job codes table is not having any gender references, so how does SAS determine say for eg., that there are 8 F MECH02 employees? TIA!!
You told it which dataset to use:
data=ia.mechanics
The first part is the LIBREF. Something that ran before your code created the libref named IA that points to the location where SAS could find a dataset name MECHANICS.
To see what the data looks like try running PROC PRINT (since you only have 34 observations).
proc print data=ia.mechanics;
var gender jobcode;
run;
It didn't. It created it from the actual dataset where the observations have values for both variables so you can count how many observations had GENDER=F and JOBCODE=MECH02.
Note that it created the first two REPORT the same way.
I try to avoid using the term "table" which has become overloaded with meanings. Some people use it to refer to datasets instead of the original meaning of a tabular report like the ones you showed.
But how does it know how to access those datasets that have both the values in them? I have not specified paths for them anywhere. Also what if there did not exist a data set in that same file path that has these values for both? How would SAS determine the values in that case?
Also for the freq disbns for the Gender and JObcode I specified the file path to those data sets . The code is as below:
Thanks for you answer!
You told it which dataset to use:
data=ia.mechanics
The first part is the LIBREF. Something that ran before your code created the libref named IA that points to the location where SAS could find a dataset name MECHANICS.
To see what the data looks like try running PROC PRINT (since you only have 34 observations).
proc print data=ia.mechanics;
var gender jobcode;
run;
Thanks Tom, dumb me, I saw only the partial data in the mechanics dataset. TYSM!!🎯
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.