------------------------------------------------------------------------------- log: C:\Documents and Settings\john\Desktop\stinfile.log log type: text opened on: 12 Jul 2002, 08:20:19 . * replace here means existing file of same name will be overwritten . * and if this file is already open then give command log close . . di "stinfile.do by Colin Cameron: Stata read in data using infile example stinfile.do by Colin Cameron: Stata read in data using infile example . . . . ********** READ DATA . * . * If data are already loaded in Stata you need to first give the command . * clear . * . * The data are in ascii file jaggia.asc . * There are 126 observations on 12 variables with three lines per obs . * The data are fixed format with . * line 1 variables 1-4 F16.8,F17.9,F17.9,F17.9 . * line 2 variables 5-8 F16.8,F17.9,F17.9,F17.9, . * line 3 variables 9-12 F16.8,F17.9,F17.9,F17.9, . * There are several ways to read in this data as these data also free format. . . **** WE DEMONSTRATE FOUR WAYS . * . * Method 1 (used here) will handle the most different types of data . * but requires a separate dictionary file to be created . * Method 2 is most convenient for fixed format data that is of simple form . * Method 3 is for free format data . * Method 4 is easier than 3 for free format data . * Method 5 is not demonstrated here but works easily for .csv files from a sp > readsheet . . * We use METHOD 1 here . . * METHOD 1: Infile: FIXED FORMAT WITH LENGTHY DICTIONARY . . infile using jaggia.dct file jaggia.dct not found r(601); end of do-file r(601); . exit, clear