Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: method needed to alternate the order of variables


From   Joseph Wagner <[email protected]>
To   [email protected]
Subject   st: method needed to alternate the order of variables
Date   Tue, 29 Jan 2008 16:11:44 -0500

I have a dataset with variables that end in an 'x' and a 'y' but follow a pattern such that:

idcode li_x lir_x li2_x li1_x id_x ptb_x pm_x pog_x . . .
. . . li_y lir_y li2_y li1_y id_y ptb_y pm_y pog_y

I have been asked to re-sort the variables so that they follow an "xy xy xy" pattern:

idcode li_x li_y lir_x lir_y li2_x li2_y li1_x li1_y id_x id_y ptb_x ptb_y pm_x pm_y pog_x pog_y

-move- would be straightforward but I have 137 pairs of variables and I have a feeling i will need to do this again in the future. I suggested -aorder- since this would place the variables in alphabetic order like "var1x var1y var2x var2y" and so forth. Unfortunately, the person who needs this dataset re-ordered claims that the data is needed by someone (using SAS) who must have the data in a a particular order.
I am using version 8.

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index