Datafile problem in MPlus PreviousNext
Mplus Discussion > Structural Equation Modeling >
Message/Author
 Sukanlaya posted on Sunday, August 14, 2011 - 7:39 pm
Tried to run a simple regression model as below but it kept saying dat file has a problem. Read the disucssion and tried to solve problem per previous post (e.g. remove the variable names etc...) still not working. Please advice.
------------------------------

ITITLE: CAUSEE interaction
DATA: FILE IS W123MPlusv04.xls;
VARIABLE: NAMES ARE change renew different costlead sales experience industry profit bizoutcome;
ANALYSIS: TYPE = RANDOM;
ALGORITHM = INTEGRATION;
MODEL: change ON different;
change on costlead;
renew on different;
renew on costlead;
different on profit;
different on bizoutcome;
costlead on profit;
costlead on bizoutcome;
sales on different costlead;
experience on different costlead;
indusrty on different costlead;

OUTPUT: sampstat stdyx ;

*** ERROR
The number of observations is 0. Check your data and format statement.
Data file: \mplus\W123MPlusv04
*** ERROR
Invalid symbol in data file:
"ÐÏࡱá" at record #: 1, field #: 1
 Linda K. Muthen posted on Monday, August 15, 2011 - 6:13 am
It sounds like you have an invalid symbol in the data set. Perhaps the first record contains names of variables or some other characters. Open the data set and see if you can find the problem. If not send the data, output, and your license number to support@statmodel.com.
 Jahun Kim posted on Friday, May 10, 2013 - 10:52 am
I tried to run GMM but encountered error message saying dat file includes invalid symbol. I checked dat file but there is no symbol shown below.

=================================
TITLE: LCM Discrepancy

DATA:
FILE is
"C:\Documents and settings\administrator\desktop\DPP\Discrepancy LCM.dat";

FORMAT IS
(f8.0 11f8.2);

VARIABLE:
NAMES ARE study_id ETHFIN5 efhdep3p
amfqd2 bmfqd cmfqd dmfqd emfqd fmfqd
cpbicpco cpbicpre cpbicpmo;

*** ERROR
The number of observations is 0. Check your data and format statement.
Data file: C:\Documents and settings\administrator\desktop\DPP\Discrepancy LCM.dat
*** ERROR
(Err#: 64)
Invalid symbol at record #: 1
The record is shown below this message

The data record is too long to print. Refer to your data file.
The first 70 characters of the data record is printed below:
"癤? 11001 3.00 .00 3.92 16.00 999.00 14.00 999.00 9"
 Linda K. Muthen posted on Friday, May 10, 2013 - 1:04 pm
Open the file in the Mplus Editor. You will find the character as the first entry in the data set. Delete it and save it.
 Vanessa Madrazo  posted on Tuesday, January 21, 2014 - 1:03 pm
Hello,


I am unable to open the file with the version of MPlus that I have. Is it because I have the student version? (see below)

Mplus Version 7.11 Base Program Single-User License with pdf User's Guide (Students). Download contains both 32-bit and 64-bit programs for Microsoft Windows, Mac OS X, and Linux.
 Linda K. Muthen posted on Tuesday, January 21, 2014 - 1:31 pm
The student version is identical to the regular version. What do you mean by "unable to open the file". Which file?
 Margarita  posted on Monday, February 24, 2014 - 9:19 am
Dear Dr. Muthen,

I am trying to run a simple EFA and I get the same error, but the dataset seems fine.

DATA: FILE = '/Users/Desktop/pc.dat';
FORMAT = 16f1.0;

VARIABLE:

NAMES = pc1 pc2 pc3 pc4 pc5 pc6 pc7 pc8 pc9 pc10 pc11 pc12 pc13 pc14 pc15 pc16;

USEVARIABLES = pc1 - pc16;
CATEGORICAL = pc1 - pc16;


but i get the following message:


*** ERROR
The number of observations is 0. Check your data and format statement.
Data file: /Users/Desktop/pc.dat
*** ERROR
(Err#: 64)
Invalid symbol at record #: 1
The record is shown below this message
"Ôªø1114111111121312"

- I am using the SPSS20 and I working on a Mac. However, the rest of my datasets work fine
 Margarita  posted on Monday, February 24, 2014 - 10:24 am
Oh I corrected the problem!

I opened the dat. file using Mac TextEdit, and even though I could not see the "Ôªø" I deleted the empty space anyway, and the problem was fixed. Why is that? Was the symbol there, but could not read it in the TextEdit?
 Linda K. Muthen posted on Monday, February 24, 2014 - 10:30 am
Yes, the symbol was there but you could not see it. You did the correct thing. It seems to be related to a change in the last version of SPSS.
 Margarita  posted on Monday, February 24, 2014 - 10:46 am
I see.. I will keep that in mind.

Thank you so much for your reply!
 Sharon kwan posted on Wednesday, February 26, 2014 - 8:51 pm
Hello Prof,

I have the same problem as well. I have tried many times but still failed. I am trying to do EFA for 19 items. Below is the output.

INPUT INSTRUCTIONS

TITLE: efa bull
DATA: FILE IS C:\Users\kwass004 \Desktop\efa.bul.dat;
VARIABLE: NAMES ARE BUL1-BUL19;
ANALYSIS: TYPE = EFA 1 4;
OUTPUT: MODINDICES;

*** ERROR
The number of observations is 0. Check your data and format statement.
Data file: C:\Users\kwass004\Desktop\efa.bul.dat
*** ERROR
Invalid symbol in data file:
"" at record #: 1, field #: 1

sample file in dat. file (open with note pad)
1.00 1.00 1.00 1.00 1.00 2.00 1.00 2.00 1.00

I am trying to deleted the space to 1.00 1.00 1.00 1.00 1.00 as suggested in above messages but I still can't get the result. I am a PhD scholar. All my analysis depend to Mplus. Can you please advice me about this error? Thanks a lot!
 Linda K. Muthen posted on Thursday, February 27, 2014 - 6:03 am
Open the data file in the Mplus Windows Editor. Delete the invalid character and resave the data. You can only see this character in the Mplus Editor.
 Sharon kwan posted on Thursday, February 27, 2014 - 7:43 am
Thanks prof for your reply.
Do you mean that I open the dat.file through the mplus editor? I have tried to open the data file in mplus editor but couldn't. It only displayed the syntax file not the data file. Please advice. Thank you!
 Linda K. Muthen posted on Thursday, February 27, 2014 - 12:17 pm
You must be using the Mac version. Open the data file in MS Word. It will ask you about file conversion for the file. Choose the default text encoding (not Unicode (UTF-8) format). Then delete the invalid characters at the beginning of the first line.
 Sharon kwan posted on Thursday, February 27, 2014 - 6:29 pm
Prof, I got it. Thank you so much!!:-)
 christine meng posted on Sunday, March 02, 2014 - 1:09 pm
Hi Dr. Muthen,

I was running basic statistics for all my variables when I received the following error message. I opened the data file, but I didn't see any invalid symbol.

*** ERROR
(Err#: 64)
Invalid symbol at record #: 9
The record is shown below this message

The data record is too long to print. Refer to your data file.
The first 70 characters of the data record is printed below:
"440 1.00003 12000 1.77 .00 7.0 7.0 7.0 7.044 52.00 53.00"
 Linda K. Muthen posted on Sunday, March 02, 2014 - 5:06 pm
Please send the output, data set, and your license number to support@statmodel.com.
 Daria Bakina posted on Thursday, February 05, 2015 - 7:32 am
I am having similar issues with Mplus not reading my data file. I have saved it in multiple formats, checked the data and I cannot find a reason why there would be an unrecognized value. Any assistance would be extremely helpful.
Thank you!
 Linda K. Muthen posted on Thursday, February 05, 2015 - 6:53 pm
Send the data set, output, and your license number to support@statmodel.com.
 SABA posted on Tuesday, December 08, 2015 - 6:34 am
Hi, I tried to run a multiple group analysis. The data set I am using is imputed and in that imputed data sets all the IDs like teacher id, student id are changed to ******. Now when I run a model, I get this error message. Could you please tell me why the imputation is changing these auxiliary (id variables to ****)

*** ERROR
The number of observations is 0. Check your data and format statement.
Data file: C:/Users/ba8bt1/Desktop/mplus.new/missimp1.dat
*** ERROR
Invalid symbol in data file:
"**********" at record #: 1, field #: 32
Thank you for your help
 Linda K. Muthen posted on Tuesday, December 08, 2015 - 7:03 am
Please send the output and one data set along with your license number to support@statmodel.com.
 Jorge Fernando Pereira Sinval posted on Thursday, February 18, 2016 - 10:35 am
Thank you Professor, those strange characters only appeared with the Mplus editor. I used SPSS v. 23.
 Linda K. Muthen posted on Thursday, February 18, 2016 - 10:43 am
Open the file in the Mplus Editor, delete the invalid character, resave the data set.
 Angeliki Argyriou posted on Friday, February 23, 2018 - 5:00 am
Hello,

I'm using 100 imputed datasets to run a mediation analysis, but I keep getting the invalid character error message.
I made sure that I saved my original datafile (pre-imputation) without variable names in a way that I have done with other datafiles with not problems. However, following imputation, the imputed datasets all come with hundreds of stars in each one, and therefore I get the error message when I try to run an analysis on them.
I tried to manually replace all the stars in each of the 100 datasets with a blank space or delete the stars without replacing them with a blank space, but in both cases when I try to run the program I then get the "*ERROR Unexpected end of file reached in data file" message.
Do you have any suggestions?

Many thanks,

Angeliki
 Bengt O. Muthen posted on Friday, February 23, 2018 - 4:35 pm
* is the missing data flag that Mplus produces. Just give this as the missing data flag in your next run. Or do a global change in any word processor.
 marjolijn de wilde posted on Saturday, March 24, 2018 - 3:15 pm
Dear,

I guess that the answer on my question is simple, but I can't find it...

I try to run a syntax and get the following answer:

: ERROR
The number of observations is 0. Check your data and format statement.
Data file: C:\Users\mdwilde\Dropbox\databestand_nomissings'.dta.inp
*** ERROR
Invalid symbol in data file:
"conversion" at record #: 1, field #: 3"

Marjolijn
 Linda K. Muthen posted on Saturday, March 24, 2018 - 5:22 pm
Remove the variable names from the first record of the data set.
 marjolijn de wilde posted on Saturday, March 24, 2018 - 6:16 pm
Thank you very much! I indeed found this solution in previous answers and tried to do it, but after doing so I still encountered problems, so I got lost.

What I get now is this:
*** ERROR
The length of the data field exceeds the 40-character limit for free-formatted
data. Error at record #: 1, field #: 6
*** ERROR
The number of observations is 0. Check your data and format statement.
Data file: C:\Users\mdwilde\Dropbox\data.dta.inp

Sorry, this is probably too obvious, but I have no clue what this means.

Thank you very much in advance!!
Marjolijn
 Linda K. Muthen posted on Sunday, March 25, 2018 - 7:11 am
The data may be in fixed format so you need a format statement. If you cannot figure it out, send the output, data set, and your license number to support@statmodel.com.
 marjolijn de wilde posted on Monday, March 26, 2018 - 6:10 am
Hi Linda,

thank you so much for the quick follow up!

In the mean time, I succeeded to run the model. Don't know exactly why, but the 'inp' addition after the data-file-name might have caused the dammage?

Best regards,
Marjolijn
 Simon Goldberg posted on Tuesday, June 12, 2018 - 7:20 pm
I am having the same difficulty as several other users with loading my data. I receive the following error:

The number of observations is 0. Check your data and format statement.
*** ERROR
Unrecognized symbol in data file:
symbol at record #: 1, field #: 12

I have tried opening the file using the Mplus Editor but did not see an unusual symbol. Please let me know if there is something else that I can try.
 Linda K. Muthen posted on Wednesday, June 13, 2018 - 9:49 am
Are you on the Mac or Windows?
 Simon Goldberg posted on Wednesday, June 13, 2018 - 11:14 am
Mac.
 Linda K. Muthen posted on Wednesday, June 13, 2018 - 12:06 pm
It sounds like the data set has line breaks that Mplus cannot read. Open the data set in Excel on the Mac and save it as a Windows comma separated format.
 Simon Goldberg posted on Wednesday, June 13, 2018 - 2:56 pm
That worked! Thank you, Dr. Muthen.
 Shahid Khan posted on Friday, June 22, 2018 - 6:45 pm
Dear Muthen

I generated data file from SPSS and tried to run simple regression but receiving this error. can you please advise?

*** ERROR
Unexpected end of file reached in data file.

Regards
 Linda K. Muthen posted on Friday, June 22, 2018 - 8:09 pm
This is caused by one of two reasons:

1. Blanks in the file. Blanks are not allowed with free format data.

2. The number of variable names in the NAMES list is not the same as the number of columns in the data set.
 Shahid Khan posted on Friday, June 22, 2018 - 8:47 pm
Thanks for your advice.
Though this problem has been resolved but now I am getting the appended below error

*** ERROR
One or more between-level variables have variation within a cluster for
the following clusters. Check your data and format statement.

Between Cluster IDs with variation in this variable
Variable

ANCP 10 10 9 9 9 6 6
 Linda K. Muthen posted on Saturday, June 23, 2018 - 6:54 am
Any variable on the BETWEEN list must have the same value for all cluster members. This is violated for ancp in the clusters mentioned.
 lucia parry posted on Thursday, August 09, 2018 - 8:11 pm
Hi there,

It looks like I'm having the same type of problem as some of the people on this message board. I'm getting the same error message (*** ERROR
Invalid symbol in data file:
"***" at record #: 8, field #: 27), but my problem is that there are two participant IDs that are coming up with *** at the end (and in the middle of the file, not the beginning). I can't see these symbols in my SPSS file, so I'm not sure how to get rid of them correctly. I've saved my file as a Fixed ASCII and am opening it in Mplus editor.

Thanks so much for your help.
 Linda K. Muthen posted on Friday, August 10, 2018 - 1:53 pm
It sounds like the ID variable is too large for how you saved it from SPSS. Either increase the space to save these variables or save as free format.
 lucia parry posted on Friday, August 10, 2018 - 4:45 pm
Thanks, Dr. Muthen! If I increase the SPSS ID size to a width of 4 with 2 decimals (previously it only had a width of 4), will that work?

I'm also not sure how to save something as a free format.
 Linda K. Muthen posted on Friday, August 10, 2018 - 4:54 pm
I don't think so. It is the 4 that is the width. If it is an ID variable, it likely does not have decimals. How long is the ID variable?
 lucia parry posted on Friday, August 10, 2018 - 4:56 pm
The ID variable is 4 numbers long.
 Linda K. Muthen posted on Friday, August 10, 2018 - 5:27 pm
Try making the width 5. If that does not work, you should call SPSS support and ask how to save the data.
 Kirsten Smith posted on Tuesday, September 04, 2018 - 8:46 am
I am having the same issue as simon glodberg posted with the following error.

*** ERROR
The number of observations is 0. Check your data and format statement.

*** ERROR
Unrecognized symbol in data file:
symbol at record #: 1, field #: 12

I am using a mac also. You suggest he opens the dat file in excel and then saves it as a csv. However I am unclear what the next step is to get it back into a dat file so it can be used by mplus.
 Linda K. Muthen posted on Tuesday, September 04, 2018 - 9:46 am
Open the file in Excel on the Mac. Save it as Windows comma separated format. Change the name of the file in the FILE option to the name of the new data set.
 Kirsten Smith posted on Tuesday, September 04, 2018 - 10:15 am
Following your steps I end up with a filename.csv

I didn't think these could be read in mplus.

How do I get a filename.dat using this method.
 Linda K. Muthen posted on Tuesday, September 04, 2018 - 11:00 am
Use FILE = filename.csv. Mplus does not require an extension of dat.
 Yue Yin posted on Tuesday, January 08, 2019 - 2:08 pm
I have a question, I did a simulation study using mplus, so I named each file and the folder according to the different conditions. But after I run the Mplus, the output told me the character exceed 90, but I can't break the file address because once I did it, mplus can't locate my file. How can I solve it?

Thanks.
 Bengt O. Muthen posted on Tuesday, January 08, 2019 - 4:53 pm
You can break up the line if you put the full path in quotes. If you run into an error, send the output to support.
 Joy Thompson posted on Monday, March 18, 2019 - 1:02 pm
Hi,
I transferred a data file from Stata to Mplus using StatTransfer. When trying to run my code, I continue to receive error messages about some of my variables having zero variance. I believe this has to do with how the file is being read. The .dat file transferred in is free format where columns are separated by commas. Can I use the format statement to make these into fixed format? If so, how do I account for the commas? Also, what if there are a different number of digits preceding the decimal for a variable (e.g., Case 1 is 25.30 on variable X and Case 2 125.20 on variable X)? This is often the case for the weight variables that have quite a range of values. Just eyeballing the .dat file, there do not appear to be any blanks or odd characters that may be being misread.
Thank you!
Joy
 Linda K. Muthen posted on Monday, March 18, 2019 - 3:49 pm
Please send the output, data set, and you license number to support@statmodel.com.
 Laurence Wright posted on Friday, August 30, 2019 - 9:17 am
Hi there,

I was wondering if you could please help me with an issue I've been having.

Mplus seems to object to me having headings for my data in the .dat file, but presumably when I delete these it has no way of identifying what data refers to what variable? Is there any way of solving this - I am reluctant to just remove the headings.

I've listed the error below:

'*** ERROR
The number of observations is 0. Check your data and format statement.
Data file: /Users/LaurenceWright/Desktop/Test.dat
*** ERROR
Invalid symbol in data file:
"Age" at record #: 1, field #: 1'

Many thanks,

Laurence
 Bengt O. Muthen posted on Saturday, August 31, 2019 - 5:35 pm
You should not have headings in the data file. Mplus knows which variable is in which column of your data set by you including a NAMES= statement in the VARIABLE command (see the UG). Then you add a USEVARIABLE command to say which variables you want to analyze.
 Laurence Wright posted on Monday, September 02, 2019 - 1:21 am
That's very helpful, thank you
Back to top
Add Your Message Here
Post:
Username: Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Password:
Options: Enable HTML code in message
Automatically activate URLs in message
Action: