Example Jobs

 

(1) This is an example job using the unaltered weight variable. It is a simple cross-tabulation of 1995 Grade 12 annual marijuana use by sex.

libname saslib '...';
proc freq data=saslib.by95cr;
title '1995 Grade 12 Annual Marijuana Use by Sex - Unaltered Weights';
table v150*v116;
weight v5;
run;

(2) This is an example job demonstrating the use of sample design variables using SAS-Callable SUDAAN.

libname saslib '...';
data temp;
set saslib.by95cr;
run;
proc sort data=temp;
by v34 v35;
run;
proc descript data=temp design=WR DEFT1;
title 'Design Effect for Annual Marijuana, 1995';
weight v5;
nest v34 v35;
var v116;
run;

(3) This is an example job that demonstrates the creation of a "core" Grade 10 dataset for 1997. A Grade 8 core dataset can be created in an analogous manner.

libname me '/u/mydata';
libname arc '/u/mtf/gr10/data';

/* This setup file will create a "core" grade 10 dataset for 1997. It will work for grade 8, also, by substituting the appropriate input ("arc") files. Form 1 variable numbers are used to name the variables common to all forms; form 3 variable numbers are used to name the variables common to forms 3 and 4 only. Three variables in form 2, Part B are asked only in that form and so are not renumbered. Because the archived datasets are numbered sequentially in questionnaire order, the same variables are named slightly differently from year to year; hence this will not work for years other than 1997. See the document "Monitoring the Future Grade 8/10 Base Year Cross-Time Question Index" on both the standard archived data site for 8/10 data and on the Monitoring the Future Remote Access System (RAS) website for variable numbers across years. */

data f1da;
set arc.mtff110;
* Retain only the ID, region, pop density, and Qs in B & C;
keep v1 v3-v5 v507-v509 v1177-v1280;
run;

data f2renda(keep=v1 v3-v5 v507-v509 v1177-v1229 v1233-v1280 v2228-v2230);
set arc.mtff210;

* Renumber form 2 variables in parts B & C to line up with form 1 ;

%macro f2rena;
  %do i=2175 %to 2227;
  %let j=%eval(&i-998);
  rename v&i=v&j;
%end;
%mend f2rena;
%f2rena;

%macro f2renb;
  %do i=2231 %to 2278;
  %let j=%eval(&i-998);
  rename v&i=v&j;
%end;
%mend f2renb;
%f2renb;

run;

data f3renda(keep=v1 v3-v5 v507-v509 v1177-v1280 v3147-v3179);
set arc.mtff310;

* Renumber form 3 variables in parts B & C to form 1 numbers;

rename v3145=v1177 v3146=v1178 v3160=v1179;

%macro f3ren;
  %do i=3180 %to 3280;
  %let j=%eval(&i-2000);
  rename v&i=v&j;
%end;
%mend f3ren;
%f3ren;
run;

data f4renda(keep=v1 v3-v5 v507-v509 v1177-v1280 v3147-v3179);
set arc.mtff410;

* Renumber form 4 variables in parts B & C to common numbers;

%macro f4rena;
  %do i=4147 %to 4179;
  %let j=%eval(&i-1000);
  rename v&i=v&j;
%end;
%mend f4rena;
%f4rena;

rename v4145=v1177 v4146=v1178 v4160=v1179;

%macro f4renb;
  %do i=4180 %to 4280;
  %let j=%eval(&i-3000);
  rename v&i=v&j;
%end;
%mend f4renb;
%f4renb;
run;

data me.coregr10;
set f1da f2renda f3renda f4renda;
run;

proc contents data=me.coregr10;
title 'Grade 10 Base Year 97 Parts B & C from all four forms combined';
run;

proc freq data=me.coregr10;
table v3*(v1 v507-v509 v1177-v1280) /missprint nocol nopercent;
title 'Grade 10 data for parts B & C by form';
run;