Hi all,
I am getting this error and I tried to sort this in all possible ways, I do not know what else to do, can you please help me?
Thanks!
MPRINT(SERIES): data tempsas.ind_VA_by_ACPSA;
MPRINT(SERIES): merge tempsas.ind_value_added(in=a) tempsas.ind_conc;
MPRINT(SERIES): by indCode;
MPRINT(SERIES): if a=1;
MPRINT(SERIES): run;
ERROR: BY variables are not properly sorted on data set TEMPSAS.IND_CONC.
a=0 indCode=337 proVal= Inter= compensation= taxes= GOS= indCode_id=42751 indCodeDescr=Furniture and related products
indACPSA=ind99 indACPSADescr=All Other Industries FIRST.indCode=1 LAST.indCode=1 _ERROR_=1 _N_=381
NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were 381 observations read from the data set TEMPSAS.IND_VALUE_ADDED.
NOTE: There were 2 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 380 observations
and 10 variables.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.01 seconds
You need to sort the data set TEMPSAS.IND_CONC by INDCODE.
Hi,
I cannot sort this by indcode because the tempsas.ind_value_added does not have indcode, I keep getting this error for the past 3 months.
MPRINT(SERIES): data tempsas.ind_VA_by_ACPSA;
MPRINT(SERIES): merge tempsas.ind_value_added(in=a) tempsas.ind_conc;
MPRINT(SERIES): by indCode_id;
MPRINT(SERIES): if a=1;
MPRINT(SERIES): run;
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.02 seconds
cpu time 0.01 seconds
I cannot sort this by indcode because the tempsas.ind_value_added does not have indcode, I keep getting this error for the past 3 months.
That doesn't make any sense. If the variable is not there you cannot merge by it either. But the variable is clearly there according to your log. Perhaps your SORT step tried to sort by the wrong variable? The code you posted is using INDCODE_ID and your comment mentions INDCODE. Those are two different variable names.
This is a different program than the first one you posted.
In this program, you have not properly sorted variable indCode_id in data set TEMPSAS.IND_CONC
Hi Paige,
How could I properly sort it then? Do you want the entire log?
Thank you so much!
@Afor910327 wrote:
How could I properly sort it then?
proc sort data=yourdatasetname;
by variablename;
run;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.