BookmarkSubscribeRSS Feed
arv
Calcite | Level 5 arv
Calcite | Level 5

I get 3 flat file witout header. Using coded as follows-
MAVHIC01 has data-------

1 john calgary
2 Arvi vancouver

 

DaTA.BKUP_00 has data---

1 fisher Reddeer
2 Ahmadi vancouver

DaTA.BKUP_01 has data---

1 mario Ottwa
2 Julia winnipeg

FILENAME SORTA1 ('/shared/uniki//Mq.FLAT.MAVHIC01'
                 '/shared/uniki/Mq.CMA.DaTA.BKUP_00'
                 '/shared/uniki/Mq.CMA.DaTA.BKUP_01'
                                 );

I have one .sas file which has input variables and code is as follows-

**    Pos  Field Name   Length;
INPUT @1   id                 2.    /* id          */
            @1   name    $     6.    /* employee name         */
            @1   city       $     20.    /* working city           */ 

Now I wonder what will be in SORTA1 and how the data will be stored in id,name,city inputs.

4 REPLIES 4
ballardw
Super User

Without knowing whether the file referenced was using in an INFILE or FILE statement it is pretty hard to tell what may be going one.

If that is used for INFILE with that exact input statement I suspect you will likely not like the contents of Name or City.

arv
Calcite | Level 5 arv
Calcite | Level 5

Thanks for reply.

Yes, it is using INFILE as follows-

data SORTA;
INFILE SORTA1 lrecl=150 RECFM=F;
%INCLUDE '/sas//me/refr/phis.sas';

The phis.sas file has input variables.
** Pos Field Name Length;
INPUT @1 id 2. /* id */
@1 name $ 6. /* employee name */
@1 city $ 20. /* working city */

 

mkeintz
PROC Star

And, per @Kurt_Bremser's suggestion, did you try it?  What results did you get?

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------

SAS Innovate 2025: Call for Content

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!

Submit your idea!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 966 views
  • 3 likes
  • 4 in conversation