Hi everyone,
I am student, recently using stata, having touble with the creation of variables Here is a simplified version of my data:
I am looking for a way in which Stata could do the followings:
1.Create a new variable (for example "sales_comparation")
2. Then replace the variable "sales_comparation" with the value common values between sales_2022 and sales_2023
3. Replace with missing the variable "sales_comparation" when values are not the samen sales_2022 and sales_2023
The result should be this
thanks for any help!
regards
Rob
I am student, recently using stata, having touble with the creation of variables Here is a simplified version of my data:
row | sales_2022 | sales_2023 |
1 | 39011 | 39011 |
2 | 51805 | 0 |
3 | 11921 | 11921 |
4 | 0 | 77823 |
5 | 14283 | 14283 |
I am looking for a way in which Stata could do the followings:
1.Create a new variable (for example "sales_comparation")
2. Then replace the variable "sales_comparation" with the value common values between sales_2022 and sales_2023
3. Replace with missing the variable "sales_comparation" when values are not the samen sales_2022 and sales_2023
The result should be this
row | sales_2022 | sales_2023 | sales_comparation |
1 | 39011 | 39011 | 39011 |
2 | 51805 | 0 | |
3 | 11921 | 11921 | 11921 |
4 | 0 | 77823 | |
5 | 14283 | 14283 | 14283 |
regards
Rob
Comment