stop after getting the information: infile

Reply
Contributor
Posts: 51

stop after getting the information: infile

Hi everyone,

I want to infile the information in the following link. SEC EDGAR Submission 0001023875-01-000004

How can I get the information of the first company's address rather than the second company's address? That is, I want to get the information 

COMPANY DATA:  COMPANY CONFORMED NAME:               SUNBEAM CORP/FL/  CENTRAL INDEX KEY:               0000003662  STANDARD INDUSTRIAL CLASSIFICATION:     ELECTRIC HOUSEWARES & FANS [3634]  IRS NUMBER:                    251638266  STATE OF INCORPORATION:               DE  FISCAL YEAR END:               1229 

rather than

COMPANY DATA:  COMPANY CONFORMED NAME:               FRANKLIN MUTUAL ADVISERS LLC  CENTRAL INDEX KEY:               0001023875  STANDARD INDUSTRIAL CLASSIFICATION:      []  IRS NUMBER:                    223463202  STATE OF INCORPORATION:               DE  FISCAL YEAR END:               0930 

Thanh you so much for your help?

PROC Star
Posts: 7,467

Re: stop after getting the information: infile

It is too late for me and I am too tired to find whatever it is that I am missing from my logic.  However, the following should be able to give you a hint regarding how to solve your problem.  I didn't read all of the fields, as I don't know which one's you really want.

You should be able to expand the following to read what you do want:

filename thedata url "http://www.sec.gov/Archives/edgar/containers/fix010/3662/0001023875-01-000004-index.htm";

data want;

  infile thedata;

  informat Company_Name $80.;

  informat Central_Index_Key $15.;

  input @;

  _infile_=compress(_infile_,,"h");

  input

    @"COMPANY CONFORMED NAME:" Company_Name &

    @"CENTRAL INDEX KEY:" Central_Index_Key;

  if not missing(Central_Index_Key) then do;

    counter+1;

  if counter eq 3 then stop;

  end;

run;

Contributor
Posts: 51

Re: stop after getting the information: infile

Hi Arthur Tabachneck,

It works for the cases that all information I need to collect are not missing.

However, if one variable is missing, it does not work.

Could you let me know how to overcome this matter?

Thank you so much,

Contributor
Posts: 51

Re: stop after getting the information: infile

Hi Arthur Tabachneck,

For example,

filename thedata url "http://www.sec.gov/Archives/edgar/containers/fix010/3662/0001023875-01-000004-index.htm";

data want;

  infile thedata;

informat Company_Name $80.;

informat Submission_Type $10.;

informat state_Incorp $5.;

informat form_type $10. ;

informat street1 $50. ;

informat street2 $30. ;

informat city $20.;

informat state $5.;

informat zip $15.;

informat phone $15.;

informat FormerName $100. ;

  input @;

infile_=compress(_infile_,,"h");

  input

@'CONFORMED SUBMISSION TYPE:' Submission_Type &

@'FILED AS OF DATE:' DateFilled &

@'COMPANY CONFORMED NAME:' company_name &

@'CENTRAL INDEX KEY:' CIK &

@'IRS NUMBER:' ein &

@'STATE OF INCORPORATION:' state_Incorp &

@'FISCAL YEAR END:' FYE &

@'FORM TYPE:' form_type &

@'STREET 1:' street1 &

@'STREET 2:' street2 &

@'CITY:' city &

@'STATE:' state &

@'ZIP:' zip &

@'BUSINESS PHONE:' phone &

@'FORMER CONFORMED NAME:' FormerName &

@'DATE OF NAME CHANGE:' NameChangeDate;

if not missing(CIK) then do;

    counter+1;

  if counter eq 2 then stop;

  end;

run;

However, it does not work for the following link when the information of the former name does not exist.

filename thedata url "http://www.sec.gov/Archives/edgar/data/1364250/000118143114003090/0001181431-14-003090.txt";

data want;

  infile thedata;

informat Company_Name $80.;

informat Submission_Type $10.;

informat state_Incorp $5.;

informat form_type $10. ;

informat street1 $50. ;

informat street2 $30. ;

informat city $20.;

informat state $5.;

informat zip $15.;

informat phone $15.;

informat FormerName $100. ;

  input @;

  _infile_=compress(_infile_,,"h");

  input

@'CONFORMED SUBMISSION TYPE:' Submission_Type &

@'FILED AS OF DATE:' DateFilled &

@'COMPANY CONFORMED NAME:' company_name &

@'CENTRAL INDEX KEY:' CIK &

@'IRS NUMBER:' ein &

@'STATE OF INCORPORATION:' state_Incorp &

@'FISCAL YEAR END:' FYE &

@'FORM TYPE:' form_type &

@'STREET 1:' street1 &

@'STREET 2:' street2 &

@'CITY:' city &

@'STATE:' state &

@'ZIP:' zip &

@'BUSINESS PHONE:' phone &

@'FORMER CONFORMED NAME:' FormerName &

@'DATE OF NAME CHANGE:' NameChangeDate;

if not missing(CIK) then do;

    counter+1;

  if counter eq 2 then stop;

  end;

run;

Thank you so much,

Respected Advisor
Posts: 4,173

Re: stop after getting the information: infile

Like Art yesterday I shouldn't be sitting in front of my computer anymore....

When running below code I've realised that you're actually dealing with an XML structure.

filename thedata url "http://www.sec.gov/Archives/edgar/data/1364250/000118143114003090/0001181431-14-003090.txt";

data _null_;
  infile thedata;
  input;
  put _infile_;
run;

It also appears that you could get all the files as a zip archive under folder "data": http://www.sec.gov/Archives/edgar/

So instead of trying to scan the XML as text file you could also use the XML engine to read the data. I haven't found the definition of the XML schema though (too tired) but I believe going "the XML way" would be the right approach here.

Contributor
Posts: 51

Re: stop after getting the information: infile

Hi Patrick,

Thank you so much,

Ask a Question
Discussion stats
  • 5 replies
  • 303 views
  • 0 likes
  • 3 in conversation