Page 1 of 1

How to Add some data in external file in using the writecase function

Posted: December 4th, 2021, 9:23 am
by mosbi
Hello everyone,
what I want to do with CSPro is write to an external file during an investigation.
I used the WRITECASE (DICTIONARY_NAME_DICT) function but all the code is not saved please attach the screenshots
I would like how I can reach my goal?

Re: Hello everyone, what I want to do with CSPro is write to an external file during an investigation. I used the WRITEC

Posted: December 5th, 2021, 1:16 pm
by sherrell
Hi Mosbi,

writecase is used on external files. To confirm, CODEBON_SAVED_DICT is referencing an external file, yes?

Next, did you use loadcase to load the desired case into memory?

If the above is true and you're still having problems, could you post your application here? Or you can send it to us at cspro@lists.census.gov.

Thanks,
Sherrell

Re: How to Add some data in external file in using the writecase function

Posted: December 6th, 2021, 9:29 am
by mosbi
Good morning !
Related to your question: did you use loadcase to load the desired case into memory? I answer NO.
My last line of code to save information in the external file is: writecase (CODEBON_SAVED_DICT);
Do I have to use a loadcase to do the recording as well?
How do I write the syntax for this loadcase?

thanks !

Re: Hello everyone, what I want to do with CSPro is write to an external file during an investigation. I used the WRITEC

Posted: December 6th, 2021, 3:49 pm
by sherrell
Hi Mosbi,

I'm not quite clear what you're trying to write out.

Are you editing a case from the input file? If so, that will automatically be written out if an output file is given; in this situation, there is no need for loadcase or writecase statements.

Or are you trying to modify a datafile associated with an external file? If so, you *have* to perform a loadcase on the file, or you otherwise have no way to access that data. See the loadcase function help page for an explanation on the function's syntax.

https://www.csprousers.org/help/CSPro/l ... ction.html

If this still doesn't help, please zip up your application using CSPro's pack application, found under the "Tools" menu dropdown.

Thanks,
Sherrell

Re: How to Add some data in external file in using the writecase function

Posted: December 7th, 2021, 9:21 am
by mosbi
To keep it simple, I'm sending you a simplified version of what I want to do:
so I want to save the content of the second variable of the questionnaire in my external file.
I wrote the code as written in the second variable but it doesn't work.
How can I save the contents of the CODE_BON variable in the external file ???

Merci.

Re: Hello everyone, what I want to do with CSPro is write to an external file during an investigation. I used the WRITEC

Posted: December 7th, 2021, 6:34 pm
by sherrell
Hi Mosbi,

Thanks for sending the sample app. I'm not sure if you've simplified to nothing, but it looks like the dictionary you're using for the writecase command doesn't have any variables except the lone ID variable. If this is true for your non-sample/regular application, then that may be the problem, for when I added a variable, it worked fine.

If your main/non-sample application does have 1+ non-ID variables and it's still not wkg, you should probably send that out.

Sherrell

Re: How to Add some data in external file in using the writecase function

Posted: December 8th, 2021, 4:30 pm
by mosbi
Hello,
that was indeed the problem. I had a dictionary that only had identification variables with no secondary variable. as soon as i add some secondary variable in another record, adding information to the external file worked fine.

I still have another problem with the WRITECASE, but I would do another post to make it clearer to other people.
In the meantime I put this subject as resolved.
Thank you.

Re: How to Add some data in external file in using the writecase function

Posted: December 8th, 2021, 5:20 pm
by sherrell
Great! Glad that fixed it. Sherrell