Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Creating different kinds of tables using Stata17

    Hi all, I'm the beginner who starts to learn slowly about Stata, and I have several problems with the code that I'm trying to use.

    I'd like to briefly introduce that i'm currently using Stata17, and the data is house.dta. The data has size, price, etc, and I'm trying to use price and size data in this process.

    Code 1

    Code 1. my code
    clear all
    use house

    table ( size price ) () () [iweight = size]
    Code 1. what I'm trying to make
    Click image for larger version

Name:	2023-05-08_LoUqjI.png
Views:	1
Size:	52.1 KB
ID:	1712632


    Problem 1. my code is showing bunch of data not only the list of two items. Is there any code that generate the table above?



    Code 2

    Code 2. my code
    clear all
    use house

    tabstat size price, statistics(mean sd max median min skewness kurtosis)
    Code 2. what I'm trying to make
    Click image for larger version

Name:	2023-05-08_yhYhw8.png
Views:	1
Size:	37.3 KB
ID:	1712633


    Problem 2. I cannot add Standard error in my table. I used se but it was not working.



    Code 3

    Code 2. my code
    clear all
    use house

    generate prange = "prange"
    replace prange = "high" if price >= r(p50)
    replace prange = "low" if price < r(p50)

    generate srange = "srange"
    replace srange = "Small" if size < r(p25)
    replace srange = "Medium" if size < r(p50) & size >= r(p25)
    replace srange = "Large" if size >= r(p50)

    tabulate prange srange, expected
    Code 3. what I'm trying to make
    Click image for larger version

Name:	2023-05-08_zZSjjq.png
Views:	1
Size:	21.4 KB
ID:	1712634


    Problem 3. It seems like my price and size data is not categorized by the percentile which I intended.

    Thank you in advance.
Working...
X