BookmarkSubscribeRSS Feed
jap6198
Calcite | Level 5
Below is the code I keep getting this error. 
 
DATA thesis1.FAMACCWC;
74 SET thesis1.FAMACCEQ;
75 BY Historical_CRSP_PERMNO_Link_to_C;
76 LAG_WC = LAG(WC);
77 DIF_WC = DIF(WC);
78 IF FIRST.Historical_CRSP_PERMNO_Link_to_C THEN DO;
79 LAG_WC = .;
80 DIF_WC = .;
81 END;
82
83
84 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
ERROR: BY variables are not properly sorted on data set THESIS1.FAMACCEQ.
Standard_and_Poor_s_Identifier=298036 Historical_CRSP_PERMNO_Link_to_C=85077 Data_Date=12/31/2019 Data_Year___Fiscal=2019
Industry_Format=INDL Level_of_Consolidation___Company=C Population_Source=D Data_Format=STD Company_Name=STARTEK INC
ISO_Currency_Code=USD Current_Assets___Total=194.562 Assets___Total=658.083 Capital_Expenditures=15.564
Common_Ordinary_Equity___Total=225.045 Cash_and_Short_Term_Investments=32.626 Cost_of_Goods_Sold=517.291
Debt_in_Current_Liabilities___To=64.401 Long_Term_Debt___Total=184.485 Depreciation_and_Amortization=29.723
Earnings_Before_Interest_and_Tax=19.533 Income_Before_Extraordinary_Item=-15.018 Investment_Tax_Credit__Balance_S=0
Investment_Tax_Credit___Net__Cas=. Current_Liabilities___Total=172.448 Liabilities___Total=386.299
Noncontrolling_Interests___Total=46.739 Net_Income__Loss_=-15.018 Pretax_Income=-8.49 Preferred_Preference_Stock__Capi=0
Preferred_Stock___Redemption_Val=0 Retained_Earnings=-52.167 Revenue___Total=657.91 VAR33=657.91
Stockholders_Equity___Parent=225.045 Stockholders_Equity___Total=271.784 Deferred_Taxes__Balance_Sheet_=18.226
Income_Taxes_Payable=0 Working_Capital__Balance_Sheet_=22.114 Active_Inactive_Status_Marker=A PERMNO=85077 Names_Date=12/31/2020
Share_Code=11 Ticker_Symbol=SRT Share_Class= Price_or_Bid_Ask_Average=7.5199999809 Returns=-0.038363196 Shares_Outstanding=40293
Returns_without_Dividends=-0.038363196 VAR1=12/31/2020 Excess_Return_on_the_Market=0.0463 Small_Minus_Big_Return=0.0481
High_Minus_Low_Return=-0.0136 Risk_Free_Return_Rate__One_Month=0.0001 Momentum_Factor=-0.0242 market_value=303003359.23
book_to_equity=290010000 book_to_market=0.9571181017 GPOA=0.2136797334 ROE=-0.055257116 ROA=-0.02282083 GMAR=0.2137359213 WC=53.889
FIRST.Historical_CRSP_PERMNO_Link_to_C=0 LAST.Historical_CRSP_PERMNO_Link_to_C=0 LAG_WC=. DIF_WC=. _ERROR_=1 _N_=69
WARNING: The data set THESIS1.FAMACCWC may be incomplete. When this step was stopped there were 68 observations and 64 variables.
WARNING: Data set THESIS1.FAMACCWC was not replaced because this step was stopped.
96
2 REPLIES 2
blueskyxyz
Lapis Lazuli | Level 10

add proc sort before first.var or last.var

 

proc sort DATA= thesis1.FAMACCEQ;
BY Historical_CRSP_PERMNO_Link_to_C;
run;

  

ChrisNZ
Tourmaline | Level 20

1. Paste code using the appropriate icon

2. The random use of upper and lower case makes this painful to read

3. The message is pretty clear. The BY statement tells SAS that the data is sorted (or indexed) and SAS finds out it's not.

 

 

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 392 views
  • 0 likes
  • 3 in conversation