Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "Vijayakumar, Arihanth" <avijaya@essex.ac.uk> |
To | "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |
Subject | st: FW: Need help with STATA |
Date | Sun, 10 Jul 2011 11:03:49 +0000 |
Hello, I am Arihanth Vijayakumar currently pursuing my MSc. Telecommunications and Information Systems at the University of Essex, United Kingdom. I need a macro/code which can help me split a set of data for my dissertation on a particular criteria. The file is actually very large with 399327 entries of which the sample data is given below. Time (milliseconds) Length of packet 0 60 0.435 1506 1.88 60 2.337 1514 2.461 1514 5.428 60 5.828 1506 9.393 60 9.754 1112 13.89 60 14.309 1506 14.431 1506 14.554 1506 19.368 60 19.448 60 19.768 1414 19.886 1414 20.018 1506 The data runs till 9000ms (900seconds). I need to split this data in the intervals of every 100 ms and create separate worksheet/workbook. Could you please help me with the coding for the same. I tried a few codes with the help of my fellow MSc Economics students but was unsuccessful. I would be grateful if you can help me with the same. Please find attached the code created for your reference. Looking forward for your replies. Regards, Arihanth
#delimit ; clear; set more off; pause on; cd "/Users/deepaksaraswat/Desktop/arihant"; /*Load Dataset*/ use obs_stata.dta; drop in 1; gen x1=.0099; gen time1=time if time < x1; forval i= 1/10 {; local j = `i'+1; gen x`j'= x`i'+ .0100; }; save obs_stata_2.dta; use obs_stata_2.dta; forval k=2/11 {; forval i=1/10 {; gen time`k'=time if time< x`k' & time`i'==.; }; };