I have one CSV file containing data exported from multiple tables from a relational database. The tables have different number of variables and different n’s. To illustrate, let's say: • Dataset1 has 20 variables and 100 observations, • Dataset2 has 30 variaables and 20 observations, • Dataset3 has 10 variabels and 99 observations, I'm used to seeing separate csv files for each data table, however this csv file has been setup this way: • The first line contains the variable names for Dataset1 • The next 100 lines contains data for each observation • The next line contains the variable names for Dataset2 • The next 20 lines – data for the 20 observations • The next line – variable names for Dataset3 • The next 99 lines – data for the 99 observations So my question is: How can I process this unusual csv file, and output it into 3 separate datasets? (For me it's "unusual" because it's my first time seeing an export like this, but it may not be that unusual to others.) I suspect, I’ll need a statement/set of statements that loops through each line of the file – but am a little lost on which statement/function would work best. I’d really appreciate it if anyone can point me in the right direction. I also need to write code that dynamically extracts the 3 datasets from the file, as the n’s for each dataset will increase over time. However, I think I can figure out a way to do that once I get directions for my first question.
... View more