Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: Insheet Dataset Problem


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: Insheet Dataset Problem
Date   Mon, 9 Apr 2007 19:00:13 +0100

Friedrich is right. The help is right. 

You cannot select variables
with -insheet-. The key word here is "select". 

Focus on your .csv. Evidently it has names in 
the first line. Evidently you have more than
3 variables and wish to select 3. Suppose you
have 7 variables. 

You can read your existing 7 variables in using -insheet, names-. 
Or you can read your existing 7 variables in using
7 different names that you supply. 

You cannot select 3 variables by specifying 3 names. 
For that reasonable need, you need other commands. 

The error message is, I would agree, not very helpful. 
I think -insheet- has read to the end of your file in 
an attempt to make sense of your command. When it could
not reconcile the data file with your command, it bailed
out.  

Nick 
[email protected] 

Benjamin Allaire 

> So there must be an error in the help file for the insheet 
> command then -
> when I type "help insheet "I get:
> 
> insheet [varlist] using filename [, options]
> 
> Which is incorrect, if I am reading these responses correctly.
> 
> Also - I am using the Stata for mac, sorry if I didn't specify that.

Friedrich Huebler 

> You cannot select variables with -insheet-.
> 
>    sysuse auto
>    outsheet using auto.csv, comma
>    clear
>    insheet make price mpg using auto.csv
> too few variables specified
> error in line 76 of file
> r(102);
>    insheet using auto.csv
> (12 vars, 74 obs)

Benjamin Allaire 

> I'm trying to import a dataset into
> >intercooled
> >stata and it contains too many variables, so I was trying to
> >insheet the
> >variables I need.  It's a csv file and I tried the following
> >command:
> >
> >insheet district month year using cfy06e3.csv, c names clear
> >
> >And got the following error:
> >
> >too few variables specified
> >error in line 3934 of file
> >r(102);
> >
> >which is odd considering there are only 3932 observations and I
> >don't
> >particularly expect to get an error like this with the insheet
> >command.

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index