@Afor910327 wrote:
Hi there,
Thank you for your response, SAS is by far the worst language of all, I keep following the tips of everyone here and nothing seems to work at all.
You're sorting the data set but using the wrong name after.
You're sorted data set name is
proc sort data=tempsas.ind_conc out=tempsas.ind_conc_sort;
by indCode_id;
But in the merge code you're using:
ERROR: BY variables are not properly sorted on data set TEMPSAS.IND_CONC. a=1 indCode_id=41991 datasetPeriod_id=1576 proVal=4.3776485046 Inter=3531.2584548 compensation=2528.7734829 taxes=45.311020873 GOS=-6100.96531 indCode=333517 indCodeDescr=Machine tool (metal forming types) manufacturing indACPSA=ind99 indACPSADescr=All Other Industries FIRST.indCode_id=1 LAST.indCode_id=0 _ERROR_=1 _N_=549 NOTE: MERGE statement has more than one data set with repeats of BY values. NOTE: The SAS System stopped processing this step because of errors. NOTE: There were 543 observations read from the data set TEMPSAS.IND_VALUE_ADDED. NOTE: There were 313 observations read from the data set TEMPSAS.IND_CONC. WARNING: The data set TEMPSAS.IND_VA_BY_ACPSA may be incomplete. When this step was stopped there were 545 observations and 11 variables. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.00 seconds
Fix your code to use the correct input data set to be merged. If you don't want to deal with presorting the data sets then merge using SQL instead.
Please sort the tempsas.ind_conc by indCode_id before the merge step to avoid the error.
Hi there,
Like this, right?
proc sort data=tempsas.ind_conc out=tempsas.ind_conc_sort;
by indCode_id;
yes
Thank you Jag, but I keep getting the same error, time after time...
I have attached the latest log, I had done this before and nothing works!
You forgot to replace the data set name in the merge with the new sorted data set name.
TEMPSAS.IND_CONC
is not ind_conc_SORTED
@Afor910327 wrote:
Thank you Jag, but I keep getting the same error, time after time...
I have attached the latest log, I had done this before and nothing works!
Use PROC SORT and sort your data properly before merging.
Any procedure or data step that uses a BY statement will require the data to be sorted by the same variables listed in the same order as the By statement.
Hi there,
Thank you for your response, SAS is by far the worst language of all, I keep following the tips of everyone here and nothing seems to work at all.
@Afor910327 wrote:
Hi there,
Thank you for your response, SAS is by far the worst language of all, I keep following the tips of everyone here and nothing seems to work at all.
You're sorting the data set but using the wrong name after.
You're sorted data set name is
proc sort data=tempsas.ind_conc out=tempsas.ind_conc_sort;
by indCode_id;
But in the merge code you're using:
ERROR: BY variables are not properly sorted on data set TEMPSAS.IND_CONC. a=1 indCode_id=41991 datasetPeriod_id=1576 proVal=4.3776485046 Inter=3531.2584548 compensation=2528.7734829 taxes=45.311020873 GOS=-6100.96531 indCode=333517 indCodeDescr=Machine tool (metal forming types) manufacturing indACPSA=ind99 indACPSADescr=All Other Industries FIRST.indCode_id=1 LAST.indCode_id=0 _ERROR_=1 _N_=549 NOTE: MERGE statement has more than one data set with repeats of BY values. NOTE: The SAS System stopped processing this step because of errors. NOTE: There were 543 observations read from the data set TEMPSAS.IND_VALUE_ADDED. NOTE: There were 313 observations read from the data set TEMPSAS.IND_CONC. WARNING: The data set TEMPSAS.IND_VA_BY_ACPSA may be incomplete. When this step was stopped there were 545 observations and 11 variables. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.00 seconds
Fix your code to use the correct input data set to be merged. If you don't want to deal with presorting the data sets then merge using SQL instead.
Thank you so much, finally it worked for now!
@Afor910327 wrote:
Hi there,
Thank you for your response, SAS is by far the worst language of all, I keep following the tips of everyone here and nothing seems to work at all.
Say that after you have done some assembler programming.
Spelling is critical in every programming language I know and using the wrong reference seldom yields desired results.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.