Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: extracting of data


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: extracting of data
Date   Mon, 31 Dec 2012 17:40:11 +0000

I don't understand what is holding you up. Your code shows that you
are familiar with -foreach- and -forval-. So you need to write another
big loop using that construct.

Nick

On Mon, Dec 31, 2012 at 4:37 PM, Prakash Singh <prakashbhu@gmail.com> wrote:
> Nick, I thanked you for that
>
> I mentioned in the first mail that the structure of the data is such
> that to have final data I need to extract 9 (using 9 dct file for each
> level) different level files then some of them I need to reshape and
> then merge them.
>
>
> Hope, I have made my query more clear to you.
>
> regards
> Prakash
> On Mon, Dec 31, 2012 at 9:48 PM, Nick Cox <njcoxstata@gmail.com> wrote:
>> You don't comment on my replacement of 9 lines of code with 1.
>>
>> Your main loop looks like another -forval- or -foreach- loop but you
>> don't explain why you want to save different levels in different
>> datasets.
>>
>> Nick
>>
>> On Mon, Dec 31, 2012 at 2:27 PM, Prakash Singh <prakashbhu@gmail.com> wrote:
>>> Nick sorry but that is type error.
>>> Thanks for the suggestion anyway.
>>>
>>> Moreover I am looking some help on creating look so that I can repeat
>>> the following code for each level 1 to 9.
>>>
>>> clear
>>> set more off
>>> set mem 500m
>>> tempfile mydata
>>> foreach l of numlist 11/19 {
>>>    infile using D:\TEAM_PC\level`l'.dct, clear
>>>    capture append using `mydata'
>>>     save `mydata', replace
>>> }
>>> use `mydata', clear
>>> keep if level==1
>>> save level1_list.dta", replace
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index