WEEK 3 - Making data management decisions
1.- CODE
LIBNAME MILIBRO "/home/u59780920/sasuser.v94" /*access=readonly*/; DATA MISDATOS; set MILIBRO.MISDATOS; /*libraryNAME.dataNAME*/ /*Labeling the relevant variables*/ LABEL ID="Unique ID" S1="Sex" S3A="Living with her mother (2 means YES)" S3B="Living with her father (2 means YES)" S3A1="Living with her mother only" S3B1="Living with her father only" S7M="Mother's prof. situation" S8="Mother's prof. category" S81="New mother's prof. categorization" S34="Wished study level"; /*Set missing data (9 means EMPTY)*/ IF S1=9 then S1=.; IF S3A=9 then S3A=.; IF S3B=9 then S3B=.; IF S7M=9 OR S7M=6 then S7M=.; /* 6 means I DON'T KNOW*/ IF S8=99 then S8=.; IF S34=9 then S34=.; /*Creating secondary variables*/ IF S3A=. then S3A1=.;/*If the main variable is empty*/ IF S3A=2 AND S3B=1 then S3A1=2;/*If lives with her mother and not with her father*/ ELSE IF S3A=2 and S3B NE 1 then S3A1=1; /*If lives with her mother and with her father or there is no info about him*/ IF S3A=1 then S3A1=1;/*If does not live with her mother*/ IF S3B=. then S3B1=.;/*If the main variable is empty*/ IF S3B=2 AND S3A=1 then S3B1=2;/*If lives with her father and not with her mother*/ ELSE IF S3B=2 and S3A NE 1 then S3B1=1; /*If lives with her father and with her mother or there is no info about her*/ IF S3B=1 then S3B1=1;/*If does not live with her father*/ /*Grouping the variable "S8-Mother`s Professional Category" into less categories*/ IF S8=1 OR S8=2 then S81=5;/*Prof. category that require University degree*/ IF S8=3 OR S8=4 then S81=4;/*Prof. category that require High Vocational Training*/ IF S8=5 OR S8=6 then S81=2;/*Prof. category that require Medium Vocational Training*/ IF S8=7 OR S8=8 then S81=3;/*Prof. category that require Bachelor*/ IF S8=9 then S81=1;/*Prof. category that require Mandatory studies*/ IF S8=. then S81=.; /*Only girls are part of this study and 1 means girl*/ IF S1=1; PROC SORT; by ID; /*Sorted by the unique student ID*/ /*Frequency tables*/ PROC FREQ; tables S1 S3A S3B S3A1 S3B1 S7M S8 S81 S34; /*Data tables for checking*/ /*PROC PRINT; var S8 S81; PROC PRINT; var S7M S81;*/ RUN;
2.- RESULTS
STEP 1
First data management decision has been to code out missing data in all affected variables.
Later I have created secondary variables obtaining when the girls live with their mother only or with their father only, creating the variables S3A1 and S3B1.
Finally, as there are many options for the question “Mother professional situation” (variable S8), I have decided to make smaller groups, grouping those professional categories that imply similar level of studies, creating the new variable S81. Initially there were 10 different categories (including empty-99) and I have grouped them in 5 + the empty category (.). Trying to make it easier to compare, I have used the same logic than the Level of Wished Studies (variable S34) answered on the next question, i.e. if the mother’s professional category implies university studies then the classification for the new variable S81 is 5, and so on.
STEP 2
In the frequency distribution tables it is interesting to see that 98% of girls live with their mother (11.5% with her only) compared to the 87% that live with their father (1.3% with him only). (See below tables 1 and 2)
Regarding the new variable S81, around 60% of mothers do a job that only requires mandatory or basic studies (1-35.4% and 2-25.6%) and there is only a 10% of mother doing a job with university degree. (See Table 3)













