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

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
mosbi
Posts: 23
Joined: April 8th, 2021, 4:13 am

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

Post 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?
Attachments
HERE-IS-A-DESCRIPTION-WITH-IMAGES-TO-BETTER-UNDERSTAND-ME.jpeg
HERE-IS-A-DESCRIPTION-WITH-IMAGES-TO-BETTER-UNDERSTAND-ME.jpeg (654.57 KiB) Viewed 1995 times
HERE IS A DESCRIPTION WITH IMAGES TO BETTER UNDERSTAND ME.pdf
(98.48 KiB) Downloaded 109 times
Last edited by mosbi on December 8th, 2021, 4:34 pm, edited 2 times in total.
sherrell
Posts: 397
Joined: April 2nd, 2014, 9:16 pm
Location: Washington, DC

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

Post 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
mosbi
Posts: 23
Joined: April 8th, 2021, 4:13 am

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

Post 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 !
Last edited by mosbi on December 8th, 2021, 4:34 pm, edited 1 time in total.
sherrell
Posts: 397
Joined: April 2nd, 2014, 9:16 pm
Location: Washington, DC

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

Post 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
mosbi
Posts: 23
Joined: April 8th, 2021, 4:13 am

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

Post 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.
Attachments
Sample exemple.zip
(202.2 KiB) Downloaded 117 times
Last edited by mosbi on December 8th, 2021, 4:35 pm, edited 1 time in total.
sherrell
Posts: 397
Joined: April 2nd, 2014, 9:16 pm
Location: Washington, DC

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

Post 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
mosbi
Posts: 23
Joined: April 8th, 2021, 4:13 am

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

Post 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.
sherrell
Posts: 397
Joined: April 2nd, 2014, 9:16 pm
Location: Washington, DC

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

Post by sherrell »

Great! Glad that fixed it. Sherrell
Post Reply