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: AW: st: AW: list output transpose


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: AW: st: AW: list output transpose
Date   Fri, 12 Mar 2010 10:25:58 +0100

<>

I am glad we made it :-) BTW, -ds- is back, as seen in the latest -h
whatsnew-: "To be clear, ds is as fully up to date and fully supported as
any other official command of Stata."



HTH
Martin

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Joerg Eulenberger
Sent: Freitag, 12. März 2010 08:55
To: statalist@hsphsun2.harvard.edu
Subject: Re: AW: st: AW: list output transpose

Thanks a lot Martin,
i found a solution to automate the decode part:

ds, has(vall)
foreach var of varlist `r(varlist)'{
  decode `var',gen(`var'2)
  move `var'2 `var'
  drop `var'
 }

that's what i want.
Thanks,
Jörg



Martin Weiss schrieb:
> <>
>
>
> I am not particularly proud of this, but here is a solution that does put
> the value in there:
>
>
> *******
>
> sysuse auto, clear
>
> tempname hdle
> capt erase info.dta
>
> //for the first car in the dataset
> //depends on -sort- order...
> keep in 1
> decode foreign, gen(strforeign)
> drop foreign
>
> postfile `hdle' str30(varlabel value) /* 
> */ using info
>
> foreach var of varlist _all{
> 		local val = `var'
> 		post `hdle' ("`: var label `var''") ("`val'")
> }
>
> postclose `hdle'
> u info, clear
> l, noo
> *******
>
>
> HTH
> Martin
>
> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Joerg
Eulenberger
> Sent: Donnerstag, 11. März 2010 19:35
> To: statalist@hsphsun2.harvard.edu
> Subject: Re: AW: st: AW: list output transpose
>
> Tanks Martin its great.
> Only one question.
> In the case of  the variable "car typ", is it possible to get the label 
> "domestic" in the output and not the value zero?
> Tanks a lot,
> Jörg
>
>
> Martin Weiss schrieb:
>   
>> <> 
>>
>>
>> Say -keep in 2- if you want the second car...
>>
>>
>> *************
>> sysuse auto, clear
>>
>> tempname hdle
>> capt erase info.dta
>>
>> //for the first car in the dataset
>> //depends on -sort- order...
>> keep in 1
>>
>> postfile `hdle' str30(varlabel value) /* 
>> */ using info
>>
>> foreach var of varlist _all{
>> 		local val = `var'
>> 		post `hdle' ("`: var label `var''") ("`val'")
>> }
>>
>> postclose `hdle'
>> u info, clear
>> l, noo
>> *************
>>
>>
>>
>> HTH
>> Martin
>>
>>
>> -----Ursprüngliche Nachricht-----
>> Von: owner-statalist@hsphsun2.harvard.edu
>> [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Joerg
>> Eulenberger
>> Gesendet: Donnerstag, 11. März 2010 13:57
>> An: statalist@hsphsun2.harvard.edu
>> Betreff: Re: st: AW: list output transpose
>>
>> Thanks Martin but i search only a other displayformat for the 
>> list-command-output. All data of one proband in an table with two
columns.
>>
>> sysuse auto, clear
>> foreach var of varlist * {
>>    char `var'[varname] "`: var label `var''"
>> }
>> keep in 1
>> list, noobs subvarname abbreviate(33)
>>
>>
>>   
>>
>>     
>
+---------------------------------------------------------------------------
>   
>> ---+
>>   | Make and Model | Price | Mileage (mpg) | Repair Record 1978 | 
>> Headroom (in.) |
>>   | AMC Concord    | 4,099 |             |                  3 
>> |            2.5 |
>>   
>>
>>     
>
|----------------------------------------+----------------------------------
>   
>> ---|
>>   | Trunk space (cu. ft.) | Weight (lbs.)  | Length (in.)  | Turn Circle 
>> (ft.)   |
>>   |                    11 |         2,930  |          186  
>> |                 40  |
>>   
>>
>>     
>
|---------------------------------------------------------------------------
>   
>> ---|
>>   |      Displacement (cu. in.)      |      Gear Ratio      |      Car 
>> type      |
>>   |                         121      |            3.58      |      
>> Domestic      |
>>   
>>
>>     
>
+---------------------------------------------------------------------------
>   
>> ---+
>>
>> The data display is correct but I want a output like this:
>>               
>> Make and Model            AMC Concord
>> Price                               4,099
>> Mileage (mpg)                22
>> Repair Record 1978       3
>> Headroom (in.)               2.5
>> .....
>> Car type                         Domestic
>>
>> Thanks,
>> Jörg
>>
>>
>>
>>
>>
>> Joerg Eulenberger schrieb:
>>   
>>     
>>> Dear Martin,
>>> i want to show the label not the numeric value of the variable, if 
>>> there a label-set. Like by car type.
>>> Jörg
>>>
>>>
>>>
>>> Martin Weiss schrieb:
>>>     
>>>       
>>>> <>
>>>> What do you want the second column to show? (What is " labelled 
>>>> output in
>>>> the value-column."?)
>>>>
>>>> I recommend you apply the latest update (09mar2010) to Stata via
-update
>>>> all- and apply the brand new -desc, replace clear- command which 
>>>> gives you
>>>> the variable labels in no time...
>>>>
>>>>
>>>>
>>>>
>>>> HTH
>>>> Martin
>>>>
>>>>
>>>> -----Ursprüngliche Nachricht-----
>>>> Von: owner-statalist@hsphsun2.harvard.edu
>>>> [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Joerg
>>>> Eulenberger
>>>> Gesendet: Donnerstag, 11. März 2010 10:08
>>>> An: statalist@hsphsun2.harvard.edu
>>>> Betreff: st: list output transpose
>>>>
>>>> Dear statalisters,
>>>> i search a possibility to transpose the list-output for an 
>>>> individual-analysis. The origin dataset have over 4000 variables.
>>>> The dataset include numeric and string variables.
>>>>
>>>> *****************
>>>> sysuse auto, clear
>>>> foreach var of varlist * {
>>>>     char `var'[varname] "`: var label `var''"
>>>> }
>>>> keep in 1
>>>> list, noobs subvarname abbreviate(33)
>>>>
>>>> ?????????????????????????????
>>>>
>>>> *****************
>>>> and now, i search a possibility to transpose the outputtable.
>>>> A table with two columns and a row for each variable.
>>>> With subvarname in the label-column and labelled output in the 
>>>> value-column.
>>>>
>>>> Thanks,
>>>> Jörg
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> *
>>>> *   For searches and help try:
>>>> *   http://www.stata.com/help.cgi?search
>>>> *   http://www.stata.com/support/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/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/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/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/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/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/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/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/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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