How to separate data file by geographical code

Discussions about editing and cleaning data
Forum rules
New release: CSPro 8.0
Post Reply
Zaw Zaw Lin
Posts: 2
Joined: November 14th, 2012, 11:49 pm

How to separate data file by geographical code

Post by Zaw Zaw Lin »

Dear people,

Thank you , this forum help me a lot.I have one questions though of which I hope you can help me finding an answer:

- How can i separate my data file by geographical code.

My problem is at first i concatenate data files into one file. And then i went to separate that data file into several data files according to geographical code by using batch Edit application.


I hope you can help me out. I am most certainly not a pro, but I want to learn! Thanks!
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: How to separate data file by geographical code

Post by Gregory Martin »

There are several ways to do this.

1) Run a batch application and selectively execute skip case statements. If you run this one time for each geographic area, you can then create a different file for each area. This works well enough if you have a small number of areas.

2) If you have a lot of areas and your dictionary is a one-level dictionary, it might be best to add the dictionary as an external dictionary to your program and then execute loadcase/writecase statements, reading from one file and writing out to many different files.

I can give you an example if you upload your dictionary and tell me what item or items determine your geographic codes.
Zaw Zaw Lin
Posts: 2
Joined: November 14th, 2012, 11:49 pm

Re: How to separate data file by geographical code

Post by Zaw Zaw Lin »

Dear Gregory Martin,

As first i would like to say thanks for your answer.Now i already upload example of my dictionary file.According to my dictionary file SR item is main geographical code.At first we enter all data into one file and our data files is so big include so many SR(geographic ) codes. Now, as for me i want to separate several files according to SR or geographical code. Example in data file include 10 SR(geographic ) codes.Now i need to separate one by one according to SR.
Attachments
Example .rar
Example data dictionary file
(1.72 KiB) Downloaded 827 times
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: How to separate data file by geographical code

Post by Gregory Martin »

I decided to add a language feature that will make tasks like this much easier. I've introduced a function to the CSPro language, setoutput, that will allow you to change the output of your batch application. Get the latest beta here and you can use it for your application: http://www.csprousers.org/beta/

Your application is as simple as this:
PROC SR

    
setoutput(maketext(".\split\%02d.dat",SR));
See attached and you can experiment with the program.
Attachments
setoutputExample.zip
(21.13 KiB) Downloaded 967 times
lls
Posts: 109
Joined: December 6th, 2011, 3:11 pm
Location: Geneva, Switzerland

Re: How to separate data file by geographical code

Post by lls »

Thank you for the setoutput fonction and the split example.

It is very useful.
Post Reply