Announcement

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

  • #16
    Originally posted by Nigar Abduva View Post
    Dear Svend,

    I need to create those three variables because I will construct table and each of these asset groups will be the row of this table
    In that case Svend is right. Keep the variable as categorical. Example with 6 categories:

    Code:
    sysuse auto, clear
    collapse (sum) price , by(rep78)
    format price %10.0fc
    list
    Also note that all the values you've shown appear to be under 50mln. Make sure you read the number correctly.

    Best, Sergiy Radyakin

    Comment


    • #17
      Dear all,

      I'm trying to solve something that seems rather easy but just doesn't work out. I hope one of you can help me out:

      I'm using a dataset on cars in Belgium. Apart from brand and car-characteristics, one column lists the "origin".
      For the brand "alpharomeo" the variable org = "Italy", for the brand "peugot", org="France" and so on.

      Now I want to create a variable for all cars of European origin.

      I tried the command:

      gen EU = (org == "Italy" "France" "Germany" "UK" "Sweden" "Spain" "EasternEurope")

      but got the error: "type mismatch". The names of the countries are in red (not sure whether this is supposed to be or not).

      I then found this forum and tried:

      gen EU=""
      (298 missing values generated)

      replace EU="EU1" if org=="Italy" "France" "Germany" "UK" "Sweden" "Spain" "EasternEurope"

      But got the error "EU1" not found



      What am I doing wrong?

      Kind regards,
      Wouter

      Comment


      • #18
        #17 also asked and answered at https://www.statalist.org/forums/for...ing-if-command

        Please don't repeat questions in different threads. That often leads to waste of time (and creates a bad impression transiently).

        Comment


        • #19
          Hi, I want to generate a new variable 'evaluation' and mark the value to be yes if there is any value in the variable 'positive_screen'

          Can you someone please help with the command?

          Thanks

          Comment

          Working...
          X