Sorting data files based on customized criteria

Discussions about CSEntry
Post Reply
manishcspro
Posts: 46
Joined: June 26th, 2017, 2:15 pm

Sorting data files based on customized criteria

Post by manishcspro » June 19th, 2021, 2:26 am

Hi, I want to sort the data file in order to month starting from April to March.
My data has District code, Division code, Month code and Year in primary id,
since I assigned the month code 01 to 12 starting from Jan to Dec so it sorts the data in order to Jan to Dec
but my need is to sort the data from April (month code 04) to March (month code 03) in a financial year.
Please guide me..

Gregory Martin
Posts: 1534
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Sorting data files based on customized criteria

Post by Gregory Martin » June 21st, 2021, 11:12 am

One option would be to add an item to your dictionary (on a singly-occurring record) that contains the month based on the financial year. You could use a batch application to set these values:
PROC MONTH

   
if MONTH >= 4 then
       
FINANCIAL_MONTH = MONTH - 3;
   
else
       
FINANCIAL_MONTH = MONTH + 9;
   
endif;
Then you could use the Sort Data tool to sort on FINANCIAL_MONTH.

manishcspro
Posts: 46
Joined: June 26th, 2017, 2:15 pm

Re: Sorting data files based on customized criteria

Post by manishcspro » June 22nd, 2021, 1:47 am

Thanks..

Post Reply