Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: Enumerate dataset chars


From   Sergiy Radyakin <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Enumerate dataset chars
Date   Wed, 29 May 2013 16:13:58 -0400

Dear Matt, thank you very much. This is exactly what I was looking
for! Perfect! Thank you, Sergiy.

On Wed, May 29, 2013 at 1:21 PM, Matthew White
<[email protected]> wrote:
> Dear Sergiy,
>
> The -:char- extended macro function can return a list of an evarname's
> characteristics. For example, the following keeps only the
> characteristic _dta[ReS_i] after -reshape-:
>
> webuse reshape1, clear
>
> reshape long inc ue, i(id) j(year)
>
> char list
>
> local chars : char _dta[]
> local keep ReS_i
> local chars : list chars - keep
> foreach char of local chars {
>     char _dta[`char']
> }
>
> char list
>
> The SSC packages -chardef- and -charutil- might also help.
>
> Best,
> Matt
>
> On Wed, May 29, 2013 at 1:07 PM, Sergiy Radyakin <[email protected]> wrote:
>> Dear All,
>>
>> I need to cleanup all the chars left by Stata's -reshape- command.
>>
>> Both 'char list' and 'char dir' can show me what chars are defined,
>> but I can't get the full list from the program (they do not save
>> anything in the r- or s-results).
>>
>> There is no 'char drop _all' , 'char drop *', 'char clear' or anything
>> similar. The only way appears to be to drop all the data, but this is
>> not what I can afford. Also reshape itself does not seem to have
>> anything like 'reshape cleanup'.
>>
>> So looking into the following snippet, what do I write instead of X to
>> save the dataset with char mytest1 only?
>>
>> sysuse auto, clear
>> char _dta[mytest1] first
>> char _dta[mytest2] second
>> ** ...X.......
>> save mydta
>>
>> Do not suggest 'char _dta[mytest2]' unless there is also a full list
>> of what mytest2 is after any reshape command.
>>
>> Thank you, Sergiy
>>
>> PS: in all of the above char is 'characteristic', not 'character'
>> function char()
>> *
>> *   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/
>
>
>
> --
> Matthew White
> Senior Project Associate
> Innovations for Poverty Action
> 101 Whitney Avenue, New Haven, CT 06510 USA
> www.poverty-action.org
> *
> *   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/
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index