Hi Stata folks, I am working on a dataset where each ID is associated with a numeric value comprised of 0 and 1s. What I need to do now is to extract part of the numeric values based on a rule. For instance, for a value of 1001100, I need to extract the last three digits (100); for a value of 1010110, I need to extract the last two digit (10); for a value of 1011000, I need to extract the last four digits (1000). The rule is to extract the part where the last 1 was seen (together with the 0s behind the last 1s). Is there a way to achieve this using stata? Thanks!
Related Posts with How to split numeric variables based on rule
What is the problem in my code on graphing?gr tw (scatter pgratioregional year, by(region)) (lfit pgratioregional year, by(region)) /// xlabel(…
reshape command not working due to missing valuesHello everyone, I am trying to do a reshape command for a dataset on average wages and on some World…
Model specificationHello STATALISTERS! I have a question regarding model specification. Is it okay if I transformed tw…
Rolling window granger causality or time varying granger causalityHi everyone, I wanted to know if someone would know how to implement a rolling window granger causa…
Command for calculating mean incorporating three variables (ESG, year, industry)Dear all, I am trying to calculate the average ESG score for a specific industry for a given year u…
Subscribe to:
Post Comments (Atom)
0 Response to How to split numeric variables based on rule
Post a Comment