SAVEDATA command PreviousNext
Mplus Discussion > Growth Modeling of Longitudinal Data >
Message/Author
 Stephanie Fitzpatrick posted on Wednesday, March 11, 2009 - 10:56 am
Hello,

I am running some latent transition analysis and would like to further analyze the latent classes by subject number. However, every time I run SAVEDATA: File is ltams.txt;
SAVE = cprobabilities;

I get *** WARNING in Savedata command
(Err#: 9)
Error opening data save file:
ltams.txt
Data will not be saved.

Any suggestions?

Thanks
 Linda K. Muthen posted on Wednesday, March 11, 2009 - 11:45 am
You either have a path that is not correct or you don't have privileges to open the file. If you can't figure it out, please send the problem and your license number to support@statmodel.com.
 Stephanie Fitzpatrick posted on Friday, March 13, 2009 - 8:12 am
Thank you. I figured it out.

Stephanie
 Youngoh Jo posted on Thursday, December 22, 2011 - 7:48 pm
Hi!

Using the following command "SAVE IS CPROB" I got a new data set.

How can I get a new data set with the id variable?

Thanks in advance,
 Linda K. Muthen posted on Thursday, December 22, 2011 - 8:19 pm
Use the IDVARIABLE option of the VARIABLE command.
 Youngoh Jo posted on Friday, December 23, 2011 - 3:40 pm
Thanks Linda,

I am generating new data set which include the original id varialbe.
Below is the syntax I typied.

data: file is "C:\data\this.csv";
variable: NAMES ARE ID sc2-sc6;
USEVARIABLES ARE id sc2-sc6;
IDVARIABLE IS id;
classes = c (3);
ANALYSIS: TYPE = MIXTURE;

model: %overall%
i s | sc2@0 sc3@1 sc4@2 sc5@3 sc6@4;


OUTPUT: tech1 tech8 tech11 tech14;


SAVEDATA: file is "C:\data\new.sav";
SAVE IS CPROB;

How can I get new data which include the origianl id variable?

Thanks,
 Linda K. Muthen posted on Saturday, December 24, 2011 - 6:58 am
It should with what you show. Please send the full output and your license number to support@statmodel.com.
 Matt Hawrilenko posted on Tuesday, October 15, 2013 - 6:14 pm
Hello,

I'm trying to save model-predicted values in a growth curve model. The user guide explains how to save factor scores, but not how to do it for simpler growth models and I was unable to find a solution on the forums. Is this possible in the current version of Mplus?

Reviewers have requested we calculate the reliable change index and due to missing data, I've assumed that using predicted values would be the best route. Am I missing a better alternative?

Thanks very much.

Matt
 Linda K. Muthen posted on Wednesday, October 16, 2013 - 4:02 pm
You would need to create these model-predicted values in the DEFINE command and save them.
 Helen Li posted on Friday, September 19, 2014 - 5:58 pm
Dear Professor,

How can I save class probabilities and most likely class membership for each simulated data set? Thanks!
 Linda K. Muthen posted on Saturday, September 20, 2014 - 7:00 am
Use the CPROBABILITIES option of the SAVEDATA command.
 Helen Li posted on Saturday, September 20, 2014 - 8:24 am
Thank you, Professor! But if I simulated 100 sets of data, can I obtain class probabilities and most likely class membership for all these runs using some functions in MPlus? I hope my question makes sense. Thanks!
 Helen Li posted on Saturday, September 20, 2014 - 4:19 pm
Dear Professor, as per my last question, I'm pasting the codes:

Title: New data sets to be saved
data:
FILE IS simlist.dat; !a file that contains a list of names of the generated data
Type = Montecarlo;
variable:
names are y1-y4 x1 x2 c0;
USEVARIABLES ARE y1-y4;
classes = c(2);
Auxiliary = x1 x2;
analysis:
Type = mixture;
model:
%overall%
i s | y1@0 y2@1 y3@2 y4@3;
i* s*;
i with s*;
y1-y4*(ve);
[c#1*0];
%c#1%
[i*];
[s*];
%c#2%
[i*];
[s*];
Output:Tech9;
savedata: FILE IS simp.dat;
save = cprobabilities;

The codes ran very well except that I got the following warnings and so I couldn't save the new data sets. May I know how can I get the new data sets?

"*** WARNING in SAVEDATA command
The FILE option is not available for TYPE=MONTECARLO or TYPE=IMPUTATION.
The FILE option will be ignored.
*** WARNING in SAVEDATA command
The SAVE option is not available for TYPE=MONTECARLO or TYPE=IMPUTATION.
The SAVE option will be ignored.
2 WARNING(S) FOUND IN THE INPUT INSTRUCTIONS"

Thanks always for your help!!!
 Linda K. Muthen posted on Sunday, September 21, 2014 - 6:10 am
You would need to run each data set separately to save the files you want.
 Miriam Forbes posted on Monday, May 25, 2015 - 8:59 pm
Hello,

I'm running into a problem saving cprobs with an ID variable. Could you please help me figure out the error?

The syntax I'm running is:

data:
file is "C:\data\LSAC.csv";
variable:
NAMES ARE ID Sex A1-A5 T1sweight;
USEVARIABLES ARE ID A1-A5;
IDVARIABLE IS ID;
MISSING=all(-999)
classes = c(4) cSex(2);
knownclass = cSex (Sex=1 Sex=2);
weight is T1sweight;
analysis:
TYPE = MIXTURE;
model:
%overall%
i s q cu| A1@0 A2@1 A3@2 A4@3 A5@4;
i@0; s@0; q@0; cu@0;
OUTPUT:
tech1 tech8 tech11 tech14;
SAVEDATA:
file is "C:\data\new.csv";
SAVE IS CPROB;

If I run it without "IDVARIABLE IS ID;" and remove ID from usevariables, it runs fine and saves the cprobs without an ID, but when I include the line it says:
*** ERROR
The number of observations is 0. Check your data and format statement.
Data file: c:\data\LSAC.csv
*** ERROR
Invalid symbol in data file:
"11103503" at record #: 1, field #: 1


Miri
 Linda K. Muthen posted on Tuesday, May 26, 2015 - 10:55 am
Open your data set in the Mplus Editor. You will see the invalid character at the beginning of the data set. Delete it and resave the data.
 Miriam Forbes posted on Tuesday, May 26, 2015 - 5:31 pm
Magic! The invalid character didn't show up in SPSS or Excel, but the MPlus Editor did the trick. Thanks, Linda.


All the best,

Miri
 Camilla Overup posted on Thursday, June 16, 2016 - 1:14 pm
Hello,

I am attempting to run an LCA analysis in Mplys, v7.4. I have specified the following SAVEDATA command:

SAVEDATA:
File is C:\Users\Camilla\Desktop\2.0(SMRdata2016)\2classdich.csv;
SAVE is cprob;
format is FREE;


But I get the following error message:

*** ERROR in SAVEDATA command
The syntax for the FILE option has changed. Please refer to the
Mplus User's Guide for available options.

I have looked in the manual, but I do not see any changes to the code. Might anyone be able to help me to see what the issue is?

Thanks so much,

Camilla
 Thuy Nguyen posted on Thursday, June 16, 2016 - 4:46 pm
The parentheses in your path are triggering an old Mplus feature. Remove the path or specify a different folder to save the file in.
 Camilla Overup posted on Friday, June 17, 2016 - 5:04 am
Thuy, Thank you so much! That fixed the issue. I really appreciate your help!
Happy Friday,
Best, Camilla
 Justin posted on Wednesday, August 02, 2017 - 7:43 pm
Hi,

I am saving factor scores for use in a subsequent analysis as part of a large simulation study. I am finding that my saved data is not the same length as the original data.

The input data has N=10400 and the saved data is only of length 10000. Is 10000 the maximum possible length of SAVEDATA file? Is there a way around this default value? I tried RECORDLENGTH IS 10400 but it didn't seem to work.

Thank you,
Justin
 Justin posted on Wednesday, August 02, 2017 - 7:53 pm
Forgive my previous post, it appears that the output file states that the record length is 10000, but the actual saved data does include all 10400 records. Thanks!
 cornelis johan Hembrecht posted on Thursday, December 21, 2017 - 3:00 am
Hi,

I am running an LCA and that works perfectly. Only when i try to use a 'savedata' command it says "the number of observations is 0. Check your data and format statement'. Mplus also erases the data in the file i used. without the save data command it works perfectly.
Any ideas?

Title:
Latent Class Analysis.
Data:
File is "LCAvrm1.dat";
Variable:
names =ID VLGTK VLGTL rvp pal ots swm;
usevariables = VLGTK VLGTL rvp pal ots swm;
classes = c(2);
Missing is
ots (999)VLGTK(999)VLGTL(999);
Analysis:
Type=mixture;
Plot:
type is plot3;
series is VLGTK (1) VLGTL (2) rvp (3) swm (4) pal (5)
ots (6);
Savedata:
File is "LCAvrm1.dat";
save is cprob;
output:
tech11 tech14;
 Linda K. Muthen posted on Thursday, December 21, 2017 - 7:01 am
You can't use the same file name in the FILE option in both the DATA command and the SAVEDATA command. Change the name in the SAVEDATA command.
 JuliaSchmid posted on Monday, March 12, 2018 - 2:58 am
Hi,

I'm running an LPA. I'd like to save cprob as well as an additional variable (erTraM_1), which is not an indicator of the profiles. I need the additional variable in the data file for further analysis. Is this possible in Mplus?

Thanks for your help! Julia

VARIABLE:
NAMES ARE id erTraM_1 sex sskM_1 soFaM_1 svVK4I_1 svCK3_12;

IDVARIABLE IS id;

USEVARIABLES ARE
sex sskM_1 soFaM_1 svVK4I_1;

AUXILIARY = svCK3_12;

CLASSES = c(3);
CATEGORICAL = sex svVK4I_1;
Missing = ALL(-999);

ANALYSIS:
TYPE = MIXTURE;
STARTS = 500 50;
STITERATIONS = 50;

SAVEDATA: FILE = LPA_3-CLASS_Fa.dat;
SAVE = CPROB;

OUTPUT: ;
 Bengt O. Muthen posted on Monday, March 12, 2018 - 3:39 pm
Use Auxiliary = erTraM_1;
 JuliaSchmid posted on Thursday, March 15, 2018 - 3:38 am
Thanks for the help! I'm running now the further analysis (see post above) and I have a problem with the dataset, I saved before via sava data-command.

Followin gerror message occured:

*** ERROR
Invalid symbol in data file:
"*" at record #: 72, field #: 6

What's the problem here? I thought that "*" is ok as it specify missing values.
 Linda K. Muthen posted on Thursday, March 15, 2018 - 5:02 pm
You need to add MISSING = *; in the VARIABLE command. The saved data set uses * as missing. Be sure you are reading the data set according to the specification shown at the end of the output where the data were saved.
 Hiva Y posted on Wednesday, August 29, 2018 - 7:03 am
Hi,
If I simulated 100 sets of data, can I obtain class probabilities and most likely class membership for all these runs using some functions in MPlus? Thanks!
Is RUNALL utility, in this case, can be helpful?
 Linda K. Muthen posted on Wednesday, August 29, 2018 - 1:06 pm
See Mplus using R in the left column of the website. MplusAutomation is probably easier to use than Runall.
 Georgios Sideridis posted on Monday, September 10, 2018 - 11:52 pm
Hi,
I was trying to save cprobabilities using:
SAVEDATA:
file is lpafull.txt
save is cprob;

My initial run was fine. Then I used the exact same syntax with a large data file (over 100k participants). The saved data file had only my original variables as shown below, no cprob values:

SAVEDATA INFORMATION


Save file
lpafull.txt save is cprob

Order and format of variables

D1 F10.3
D2 F10.3
D3 F10.3
D4 F10.3
ID1 I7
G I2

Save file format
4F10.3 I7 I2

Save file record length 10000

Can you please let me know what I am doing wrong?
thank you,
G.
 Bengt O. Muthen posted on Tuesday, September 11, 2018 - 2:51 pm
Please send the output, data, and savefile to Support along with your license number.
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: