NHANES uses a complex sampling structure. As such simple filtering of records will likely cause serious issues with the reliability of any estimates and you would need to use the Survery Procs, Surveyreg, Surveymeans, SurveyFreq or Surveylogistic to incorporate the sample design information.
Better in these cases is generally to add indicator variables to show the membership(s) of the subjects and then use those indicator variables as CLASS variables. Proper model or domain statements would then have results for Pregnant and Nonpregnant, assuming you did a two level indicator. Then just use the results for the classes of interest.
You may want to start with https://wwwn.cdc.gov/nchs/nhanes/tutorials/default.aspx as there are examples of SAS code for many tasks and the SAMPLE section includes specific code for merging and combining NHANES data sets.
... View more