BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
France
Quartz | Level 8

hello all,

when I am setting two dataset by following codes, the results shows,

NOTE: Data file P.PUBLIC2.DATA is in a format that is native to another host, or the
      file encoding does not match the session encoding. Cross Environment Data Access will be
      used, which might require additional CPU resources and might reduce performance.
30   data Step2.PublicationsNew ;
31   SET P.PUBLICATION1 P.PUBLICATIONS2 ;
NOTE: Data file P.PUBLICATIONS2.DATA is in a format that is native to another host, or the
      file encoding does not match the session encoding. Cross Environment Data Access will be
      used, which might require additional CPU resources and might reduce performance.
32   BY pat_publn_id ;
33   run;

ERROR: BY variables are not properly sorted on data set P.PUBLICATIONS2.
pat_publn_id=900093015 publn_auth=JP publn_nr=1174460 publn_nr_original=  publn_kind=A
appln_id=930063756 publn_date=9999-12-31 publn_lg=  publn_first_grant=0 publn_claims=0
FIRST.pat_publn_id=1 LAST.pat_publn_id=0 _ERROR_=1 _N_=98685272
NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were 98685270 observations read from the data set P.PUBLICATION1.
NOTE: There were 4 observations read from the data set P.PUBLICATIONS2.
WARNING: The data set STEP2.PUBLICATIONSNEW may be incomplete.  When this step was stopped there
         were 98685271 observations and 10 variables.
WARNING: Data set STEP2.PUBLICATIONSNEW was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           57:16.16
      cpu time            1:07.79

what should I for it, could you please give me some suggestion ?, in particular, the data set P.PUBLICATION1 has 100491569 observations, but only 98685270 observations read from the data set P.PUBLICATION1 in this process. besides, there is a note, which is

Data file P.PUBLICATIONS2.DATA is in a format that is native to another host, or the
      file encoding does not match the session encoding. Cross Environment Data Access will be
      used, which might require additional CPU resources and might reduce performance.

is it the problem ? Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Shmuel
Garnet | Level 18

When you use BY statement sas assumes that the file is sorted already.

As you have two input files both have to sorted then you need merge instead set.

 

Your inut dataset is probably created in other OS than the current one. 

Sas notes it but knows how to deal wih it.

 

Your code should include sort preceding your step:

proc sort data=P.PUBLICATION1;
   BY pat_publn_id ;
run;
proc sort data=P.PUBLICATIONS2;
   BY pat_publn_id ;
run;

data Step2.PublicationsNew ;
  merge P.PUBLICATION1
             P.PUBLICATIONS2 ;
   BY pat_publn_id ;
run;

View solution in original post

1 REPLY 1
Shmuel
Garnet | Level 18

When you use BY statement sas assumes that the file is sorted already.

As you have two input files both have to sorted then you need merge instead set.

 

Your inut dataset is probably created in other OS than the current one. 

Sas notes it but knows how to deal wih it.

 

Your code should include sort preceding your step:

proc sort data=P.PUBLICATION1;
   BY pat_publn_id ;
run;
proc sort data=P.PUBLICATIONS2;
   BY pat_publn_id ;
run;

data Step2.PublicationsNew ;
  merge P.PUBLICATION1
             P.PUBLICATIONS2 ;
   BY pat_publn_id ;
run;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1 reply
  • 630 views
  • 0 likes
  • 2 in conversation