Hello,
i want to generate a new variable that is 1 for 5 random observations and 0 otherwise within the group that has the same value for "TICKER" and "FPEDATS". How can i do that?
i want to generate a new variable that is 1 for 5 random observations and 0 otherwise within the group that has the same value for "TICKER" and "FPEDATS". How can i do that?
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str6 TICKER long FPEDATS "0000" 20088 "0000" 20088 "0000" 20088 "0000" 20088 "0000" 20088 "0000" 20453 "0000" 20453 "0000" 20453 "0000" 20453 "0000" 20453 "0000" 20453 "0001" 20088 "0001" 20088 "0001" 20088 "0001" 20088 "0001" 20088 "0001" 20088 "0001" 20088 "0001" 20088 "0001" 20088 "0001" 20088 "0001" 20088 "0001" 20088 "0001" 20088 "0001" 20088 "0001" 20088 "0001" 20088 "0001" 20453 "0001" 20453 "0001" 20453 "0001" 20453 "0001" 20453 "0001" 20453 "0001" 20453 "0001" 20453 "0001" 20453 "0001" 20453 "0001" 20453 "0001" 20453 "0001" 20453 "0001" 20453 "0001" 20453 "0001" 20453 "0001" 20453 "0001" 20453 "0001" 20453 "0001" 20453 "0001" 20819 "0001" 20819 "0001" 20819 "0001" 20819 "0001" 20819 "0001" 20819 "0001" 20819 "0001" 20819 "0001" 20819 "0001" 20819 "0001" 20819 "0001" 20819 "0001" 20819 "0001" 20819 "0001" 20819 "0001" 20819 "0001" 20819 "0001" 20819 "0001" 20819 "0001" 20819 "0001" 21184 "0001" 21184 "0001" 21184 "0001" 21184 "0001" 21184 "0001" 21184 "0001" 21184 "0001" 21184 "0001" 21184 "0001" 21184 "0001" 21184 "0001" 21184 "0001" 21184 "0001" 21549 "0001" 21549 "0001" 21549 "0001" 21549 "0001" 21549 "0001" 21549 "0001" 21549 "0001" 21549 "0001" 21549 "0001" 21549 "0001" 21549 "000R" 20453 "000R" 20453 "000R" 20453 "000R" 20453 "000R" 20453 "000R" 21184 "000R" 21184 "000R" 21184 "000R" 21184 end format %td FPEDATS
Comment