Question 1:
I have a series of date variables with multiple iteratives (i.e., Date.1, Date.2 … Date.3406). I am looking to count the number of unique dates across date variables. I am using the following code. However, this code will delete the dates the aren’t unique. Preferrably, I would still like to keep those.
Question 2:
I have a series of string vars (i.e., Relation.1, Relation.2…Relation.3406)that I have recoded to numeric, categorical variables. For example: 1= Daughter, 2 = Friend, 3 = Mother. I would like to create two dummy varibales for Family and Friend. How do I compute a new Family dummy variable while combining the multiple family categories in the series of relationship variables?
Question 1: Here is the code that I used
Vector dates = DateofVisit.1 to DateofVisit.3406.
Compute uniquedatecount=0.
Loop i=1 to 3406.
Loop j = i +1 to 3406.
IF (dates(i) = dates(j))dates(j)= $SYSMIS.
END LOOP.
END LOOP.
Loop i = 1 to 3406.
IF (NOT MISSING(dates(i)))uniquedatecount= uniquedatecount+1
END LOOP
Exe.
Question 2:
I have tried COMPUTE Family = (Relation.1 to Relation.3406 = 1 3 4 5). I received an error
Symone Pate is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.