jeudi 2 juillet 2015

SAS-Adding a Zero where condition not met

Any help on this would be greatly appreciated. I am trying to add a '0' value to my data based on whether a particular ID submitted a certain code or not. To better illustrate what I am trying to do here is a sample dulled down data set, with three IDs and three codes that should be represented, followed by what I would want.

ID    Submitted_Code  Times_Submitted    Cost_Per_Each
A      42              10                  15.00
A      43               5                  30.00
B      44               6                  35.00
C      42               5                  15.00
C      43               7                  30.00
C      44               8                  35.00

For each ID that did not submit a code, the code(s) not submitted are shown, followed by zeros for times submitted. As such

   ID    Submitted_Code  Times_Submitted    Cost_Per_Each
    A      42              10                  15.00
    A      43               5                  30.00
    A      44               0                  35.00
    B      42               0                  15.00
    B      43               0                  30.00
    B      44               6                  35.00
    C      42               5                  15.00
    C      43               7                  30.00
    C      44               8                  35.00

Thanks!

Aucun commentaire:

Enregistrer un commentaire