- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 04-01-2008 03:40 PM
(1032 views)
Hi,
I have a data in this format:
Id Question text
1 c1 xx
1 c3 aa
1 h9 bb
1 h20 cc
I would like to get output in this format
id questInd textInd questocc textocc
1 c1 xx c3 aa
1 h9 bb h20 cc
I want to pair C1 with C3 and H9 with H20. But I don't want to hardcode anything, because the quest pair can change. (It could be c4 and C5 or b11 and b14) etc.
Is there a way I can accomplish this. I tried using first. last. and macro variables and array, but I am not able to get correct output.
thank you.
I have a data in this format:
Id Question text
1 c1 xx
1 c3 aa
1 h9 bb
1 h20 cc
I would like to get output in this format
id questInd textInd questocc textocc
1 c1 xx c3 aa
1 h9 bb h20 cc
I want to pair C1 with C3 and H9 with H20. But I don't want to hardcode anything, because the quest pair can change. (It could be c4 and C5 or b11 and b14) etc.
Is there a way I can accomplish this. I tried using first. last. and macro variables and array, but I am not able to get correct output.
thank you.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
For you to automate the reformating/reconfiguring of any set of data, there has to be recognizable controlling pattern.
So, in your case, what is the pattern?
Is it that the first (odd) observations are "ind" and the second (even) observations are "occ"?
If so, then there are two ways to deal with the situation:
1) random access of the dataset through dataset options.
2) use of the Lag() function.
So, in your case, what is the pattern?
Is it that the first (odd) observations are "ind" and the second (even) observations are "occ"?
If so, then there are two ways to deal with the situation:
1) random access of the dataset through dataset options.
2) use of the Lag() function.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
thanks Chuck. You were right in that I had to come up with some pattern to identify the pairs. I accoplished this through the macro variables and the do loop.