Hi,
I have two variables, "commodity" and "msci" where I have 4905 observations per variable.
In my previous post I got help to destring my variable "comprice" (which is now my variable called "commodity").
I run -destring commodity, replace(" ") dpcomma- and thereafter run: -destring commodity, replace ignore (" ") dpcomma force-
This worked out pretty well, unless around for around 150 observations where I had to remove spaces to avoid the restringing and forcing change 150 observations to "(.)" for my "commodity" variable.
The problem occurs when I am trying to do the same for my "msci" variable.
When I list the variable by -list msci- the numbers is presented all like for instance:
2,367.27
(unlike for -list commodity- which gives a number for instance like:
10709,89)
I have tried to run -destring msci, replace ignore(" ") dpcomma-
which gives me the result:
msci: contains characters not specified in ignore(); no replace
and thereafter run: -destring msci, replace ignore(" ") dpcomma force-
which gives me the result:
msci: contains nonnumeric characters not specified in ignore(); replaced as byte
(4905 missing values generated)
Then all my observations for the variable msci looks like:
(.)
4905 observations are too many to manually enter the "right" characters for Stata to accept.
Both variables are exported from excel.
So, how may I solve this problem? Can anyone please help me with the full command eventually?
Regards
Guest
I have two variables, "commodity" and "msci" where I have 4905 observations per variable.
In my previous post I got help to destring my variable "comprice" (which is now my variable called "commodity").
I run -destring commodity, replace(" ") dpcomma- and thereafter run: -destring commodity, replace ignore (" ") dpcomma force-
This worked out pretty well, unless around for around 150 observations where I had to remove spaces to avoid the restringing and forcing change 150 observations to "(.)" for my "commodity" variable.
The problem occurs when I am trying to do the same for my "msci" variable.
When I list the variable by -list msci- the numbers is presented all like for instance:
2,367.27
(unlike for -list commodity- which gives a number for instance like:
10709,89)
I have tried to run -destring msci, replace ignore(" ") dpcomma-
which gives me the result:
msci: contains characters not specified in ignore(); no replace
and thereafter run: -destring msci, replace ignore(" ") dpcomma force-
which gives me the result:
msci: contains nonnumeric characters not specified in ignore(); replaced as byte
(4905 missing values generated)
Then all my observations for the variable msci looks like:
(.)
4905 observations are too many to manually enter the "right" characters for Stata to accept.
Both variables are exported from excel.
So, how may I solve this problem? Can anyone please help me with the full command eventually?
Regards
Guest
Comment