486 IF LAG(FLAG) IN ('Max', 'Min') AND DATE < INTNX('MONTH', LAG(DATE), 1, 'SAME') THEN FLAG = LAG(FLAG);
487 run;
NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).
486:6
NOTE: Invalid numeric data, 'Max' , at line 486 column 6.
PERMNO=10000 DATE=1986-01-07 SHROUT=3680 CFACSHR=1 H=2.5625 L=2.5625 P=2.5625 FIRST.PERMNO=1 LAST.PERMNO=0
_first_date_qualified=9869 _H=2.5625 _H_date=. _L=2.5625 _L_date=. portfolio=Unqualified H_date=. L_date=. FLAG=. _ERROR_=1
_N_=1
NOTE: Invalid numeric data, 'Max' , at line 486 column 6.
PERMNO=10000 DATE=1986-01-08 SHROUT=3680 CFACSHR=1 H=2.5625 L=2.5 P=2.5 FIRST.PERMNO=0 LAST.PERMNO=0 _first_date_qualified=9869
_H=2.5625 _H_date=. _L=2.5 _L_date=9504 portfolio=Unqualified H_date=. L_date=. FLAG=. _ERROR_=1 _N_=2
NOTE: Invalid numeric data, 'Max' , at line 486 column 6.
PERMNO=10000 DATE=1986-01-09 SHROUT=3680 CFACSHR=1 H=2.5625 L=2.5 P=2.5 FIRST.PERMNO=0 LAST.PERMNO=0 _first_date_qualified=9869
_H=2.5625 _H_date=. _L=2.5 _L_date=9504 portfolio=Unqualified H_date=. L_date=. FLAG=. _ERROR_=1 _N_=3
NOTE: Invalid numeric data, 'Max' , at line 486 column 6.
PERMNO=10000 DATE=1986-01-10 SHROUT=3680 CFACSHR=1 H=2.5625 L=2.5 P=2.5 FIRST.PERMNO=0 LAST.PERMNO=0 _first_date_qualified=9869
_H=2.5625 _H_date=. _L=2.5 _L_date=9504 portfolio=Unqualified H_date=. L_date=. FLAG=. _ERROR_=1 _N_=4
NOTE: Invalid numeric data, 'Max' , at line 486 column 6.
PERMNO=10000 DATE=1986-01-13 SHROUT=3680 CFACSHR=1 H=2.625 L=2.5 P=2.625 FIRST.PERMNO=0 LAST.PERMNO=0
_first_date_qualified=9869 _H=2.625 _H_date=9509 _L=2.5 _L_date=9504 portfolio=Unqualified H_date=. L_date=. FLAG=. _ERROR_=1
_N_=5
NOTE: Invalid numeric data, 'Max' , at line 486 column 6.
PERMNO=10000 DATE=1986-01-14 SHROUT=3680 CFACSHR=1 H=2.75 L=2.5 P=2.75 FIRST.PERMNO=0 LAST.PERMNO=0 _first_date_qualified=9869
_H=2.75 _H_date=9510 _L=2.5 _L_date=9504 portfolio=Unqualified H_date=. L_date=. FLAG=. _ERROR_=1 _N_=6
NOTE: Invalid numeric data, 'Max' , at line 486 column 6.
PERMNO=10000 DATE=1986-01-15 SHROUT=3680 CFACSHR=1 H=2.875 L=2.5 P=2.875 FIRST.PERMNO=0 LAST.PERMNO=0
_first_date_qualified=9869 _H=2.875 _H_date=9511 _L=2.5 _L_date=9504 portfolio=Unqualified H_date=. L_date=. FLAG=. _ERROR_=1
_N_=7
NOTE: Invalid numeric data, 'Max' , at line 486 column 6.
PERMNO=10000 DATE=1986-01-16 SHROUT=3680 CFACSHR=1 H=3 L=2.5 P=3 FIRST.PERMNO=0 LAST.PERMNO=0 _first_date_qualified=9869 _H=3
_H_date=9512 _L=2.5 _L_date=9504 portfolio=Unqualified H_date=. L_date=. FLAG=. _ERROR_=1 _N_=8
NOTE: Invalid numeric data, 'Max' , at line 486 column 6.
May I know how to correct the following error? ERROR 161-185: No matching DO/SELECT statement.
27 DATA FLAG;
28 SET HL;
29 BY PERMNO DATE;
30 retain FLAG;
31 if first.permno then do;
32 counter = 0;
33 first_date = date;
34 end;
35 day_of_year = intnx('day', date, first_date);
36 if day_of_year <= 365 and not missing(day_of_year) then FLAG = 'UNQUALIFIED';
37
38 if PRC > LAG(H) AND date >= '01JAN1963'd then FLAG = MAX;
39 if PRC < LAG(L) AND date >= '01JAN1963'd then FLAG = MIN;
40 else FLAG = COMPARISON;
41 end;
---
161
ERROR 161-185: No matching DO/SELECT statement.
What we define "break through the historical high", excluding the data that is less than one year. Otherwise, only two days after the IPO continuing to create new highs that is not my definition of breaking through the historical high.
In addition, since we need to calculate the one-month return after breaking through the historical high/low, the group that is classified as breaking through the historical high/low must wait another month before it can be classified as the breaking through the historical high group again, because it has already been included in the breaking through the historical high/low group, it will not be classified again.
Closing Price or Bid/Ask Average
Variable Name = PRC
PRC is the closing price or the negative bid/ask average for a trading day. If the closing price is not available on any given trading day, the number in the price field has a negative sign to indicate that it is a bid/ask average and not an actual closing price. Please note that in this field the negative sign is a symbol and that the value of the bid/ask average is not negative.
If neither closing price nor bid/ask average is available on a date, PRC is set to zero. In a monthly database, prc is the price on the last trading date of the month. The price series begins the first month-end after the security begins trading and ends the last complete month of trading.
If the security of a company is included in the Composite Pricing network, the closing price while listed on NYSE or AMEX on a trading date is the last trading price for that day on the exchange that the security last traded.
If the security of a company is included in the Composite Pricing network, the closing price while listed on NYSE or AMEX on a trading date is the last trading price for that day on the exchange that the security last traded.
Similarly, highs, lows, and volumes include trades on all exchanges on which that security traded. For example, if a stock trades on both the NYSE and the PACX (Pacific Stock Exchange), and the last trade occurs on the PACX, the closing price on that day represents the closing price on the PACX, not the NYSE. Price data for Nasdaq securities comes directly from the NASD with the close of the day at 4:00 p.m. Eastern Time. Automated trades after hours on Nasdaq are counted on the next trading date, although the volumes are applied to the current date. Daily trading prices for The Nasdaq National Market securities were first reported November 1, 1982. Daily trading prices for The Nasdaq Small Cap Market were first reported June 15, 1992. prc for Nasdaq securities is always a negative bid/ask average before this time. All prices are raw prices as they were reported at the time of trading.
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.