LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (November 2009, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 18 Nov 2009 08:22:19 -0800
Reply-To:     Greg Dubrow <"dubrowg\""@*B*ERKEL%$E&Y.EDU>>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Greg Dubrow <"dubrowg\""@*B*ERKEL%$E&Y.EDU>>
Organization: A noiseless patient Spider
Subject:      arrays for multi-column data
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

The array at the bottom of this message works well to create the new variables (in the X array) from the old ones (in the exam array), using ap exam codes (in the Y array) to create a 1 or 0 value for the ap exam name, a flag if the exam was taken.

I have two questions:

1) Given that there are a number of students who have repeated some AP exams, what's a good way to suss out the dupes so that the array captures total number of exams reported (creating an new variable for a repeated subject test (i.e. apchem1 is the first exam, apchem2 is the second)?

the student record would look like this (exam values are test codes):

id# ap_srpt_exam1 ap_srpt_exam2 ap_srpt_exam3 (etc) 111 25 07 25

How to capture the 2nd value of 25 and give a value of 1 to a variable called apchem2?

2) There are 2 other variables for each exam, a score and a test date. They are ap_srpt_score1 (thru 12) and ap_srpt_date1 (thru 12). How would I write an array that says essentially if exam1=25 score1=4 and date1=0905 then apchem1=1 and apchemsc1=4 and apchemdt1=0905 (and so forth for each exam taken).

Many thanks in advance.

-Greg

** Original array; array exam{12} **the original variables in the file; Ap_Srpt_Exam1 Ap_Srpt_Exam2 Ap_Srpt_Exam3 Ap_Srpt_Exam4 Ap_Srpt_Exam5 Ap_Srpt_Exam6 Ap_Srpt_Exam7 Ap_Srpt_Exam8 Ap_Srpt_Exam9 Ap_Srpt_Exam10 Ap_Srpt_Exam11 Ap_Srpt_Exam12;

ARRAY X{42} **new variables, each an ap test name; apnone1 apushist1 aphistart1 apartdraw1 apart2d1 apart3d1 apbio1 apchem1 apchinlang1 apcomscia1 apcompscib1 apeconmic1 apeconmac1 apenglang1 apenglit1 apenvsci1 apeurhist1 apfrlang1 apfrlit1 aphumgeog1 apgermlang1 apgovus1 apgovcomp1 apintenglang1 aplatver1 aplatlit1 apitlang1 apjaplang1 apcalcab1 apcalcbc1 apcalcabsub1 apmusthry1 apmusthaur1 apmusthnonaur1 apphysicsb1 apphysmech1 apphyselect1 appsych1 apspanlang1 apspanlit1 apstat1 apwrldhist1; ; ARRAY Y{42} **the codes corresponding to the ap subject tests; (0 7 13 14 15 16 20 25 28 31 33 34 35 36 37 40 43 48 51 53 55 57 58 59 60 61 62 64 66 68 69 75 76 77 78 80 82 85 87 89 90 93);

DO J=1 TO 42; DO I = 1 TO 12; if exam{i} = y{j} then x{j}=1; END; END;

do J=1 to 42; if x{j} ne 1 then x{j}=0; END;


Back to: Top of message | Previous page | Main SAS-L page