There are several ways to obtain the closing price on the first trading day. This is probably the simplest:
set crsp.dsf (keep=permno date prc);
where missing(prc)=0 ;
by permno date; *Using DSF sort order;
if first.permno=1; *Selects the first valid case for PERMNO;
Alternatively, you can use the CRSP.STOCKNAMES file, where variable ST_DATE (starting date of price data) is available for every permno and then extract the relevant price information from CRSP daily file CRSP.DSF.
Finally, the CRSP company name file CRSP.DSFHDR can also be used to obtain the first date of price data (recorded in BEGPRC) variable.
For the last method, the code to produce the first-day price is as follows:
create table close_prc
b.date, b.permno, abs(b.prc) as prc
crsp.dsfhdr as a (keep=permno begprc)
crsp.dsf as b (keep=permno date prc)
on a.permno=b.permno and a.begprc=b.date
order by a.permno;