In addition to Phil Ryan's excellent advice, do 
check out [D] reshape. There are further worked 
examples at 
http://www.stata.com/support/faqs/data/reshape3.html
I may not be the only user who found -reshape- 
daunting when I first used it. The first few
-reshape-s can seem tricky, but like so much 
else the logic grows on you. 
Nick 
[email protected] 
Naji
 
> I'm looking for a simple command or do file in order to 
> organize a datafile
> 
> The actual datafile looks like :
> Subj    com1 com2   specific1_1 specific7_1 specific1_2 specific7_2
> 1       2    2      1           5           2           6
> 2       3    4      5           2           1           1
> 
> I'd like to build up the following file
> Subj    com1 com2   id      specific1 specific2
> 1       2    2      1       1           2
> 1       2    2      7       5           6
> 2       3    4      1       5           1
> 2       3    4      7       2           1
> 
> It can be done command by command. But I'm wondering if there 
> is an adhoc command or do file
*
*   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/