BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
SASRB
Obsidian | Level 7

Dears,

would you please explain if the permanent library should appear in the indicated place?

For example, during the practice with Foxes, I created the permanent libriary but nothing has appeared in the folder I have assigned the table to.

SASRB_0-1657118895508.png

Next question is why there is a difference in the sorting outcome between table WORK.FOX and WORK.OUT like on the screens below? 

SASRB_1-1657119254779.png

SASRB_2-1657119304320.png

Do I get it wright that both tables (WORK.FOX and WORK.OUT) are permanent?

"Fox" should be permanent as it was coded so:

"libname out "home/u61696289/EPG1V2/output/Fox";
data out Fox;
set pg1.np_species;"

And "Out" has out in its name, therefore it sould be permanent as well.

 

Thank you.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

You sorted fox but did not sort the out data set so it has the original sort order.

 

FYI - I think the OUT data set is a mistake, your code should have been OUT.FOX to create the fox data set in the OUT library. Right now it's in the work library which is not permanent and your sort or any work on the FOX data set will not be saved.

View solution in original post

6 REPLIES 6
Reeza
Super User

Your library typically goes to a folder that exists. You can create a new folder with a libname statement but I wouldn't recommend that if you're just learning.

 

Fox data set is a permanent data set in the out library.

 

*Changes the options so that a new folder can be created with a libname statement;
*Or create the folder in the OUTPUT folder first;
options dlcreatedir;

libname out "home/u61696289/EPG1V2/output/Fox";

data out.fox;
set pg1.np_species;
run;

Look for the OUT library in the Library Pane, not the Server Files and Folders Pane.

 

SASRB
Obsidian | Level 7
Thank you,
Indeed, it was in the Library Pane.
Any ideas on the difference between the sorting process outcome?
Reeza
Super User

No idea, is that all the code you ran? Can you show the log?

 

Cannot replicate with similar code.

I suspect there's something you did after the code shown, ie sort the FOX data set.

 

data out fox;
set sashelp.class;
run;
SASRB
Obsidian | Level 7

Here it is

1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 72         
 73         libname out "/home/u61696289/EPG1V2/output/Fox";
 NOTE: Library OUT was created.
 NOTE: Libref OUT was successfully assigned as follows: 
       Engine:        V9 
       Physical Name: /home/u61696289/EPG1V2/output/Fox
 74         data out Fox;
 75         set pg1.np_species;
 76         where Category='Mammal' and upcase(Common_Names) like '%FOX%'
 77         and upcase(Common_Names) not like '%SQUIRREL%';
 78         drop Category Record_Status Occurrence Nativeness;
 79         run;
 
 NOTE: There were 18 observations read from the data set PG1.NP_SPECIES.
       WHERE (Category='Mammal') and UPCASE(Common_Names) like '%FOX%' and UPCASE(Common_Names) not like '%SQUIRREL%';
 NOTE: The data set WORK.OUT has 18 observations and 7 variables.
 NOTE: The data set WORK.FOX has 18 observations and 7 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.01 seconds
       user cpu time       0.01 seconds
       system cpu time     0.00 seconds
       memory              2928.00k
       OS Memory           30640.00k
       Timestamp           06.07.2022 03:40:44 пп
       Step Count                        112  Switch Count  4
       Page Faults                       0
       Page Reclaims                     469
       Page Swaps                        0
       Voluntary Context Switches        25
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           536
       
 
 80         proc sort data=fox;
 81         by Common_Names;
 82         run;
 
 NOTE: There were 18 observations read from the data set WORK.FOX.
 NOTE: The data set WORK.FOX has 18 observations and 7 variables.
 NOTE: PROCEDURE SORT used (Total process time):
       real time           0.00 seconds
       user cpu time       0.00 seconds
       system cpu time     0.01 seconds
       memory              914.40k
       OS Memory           29612.00k
       Timestamp           06.07.2022 03:40:44 пп
       Step Count                        113  Switch Count  2
       Page Faults                       0
       Page Reclaims                     116
       Page Swaps                        0
       Voluntary Context Switches        10
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           264
       
 
 83         
 84         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 96         
Reeza
Super User

You sorted fox but did not sort the out data set so it has the original sort order.

 

FYI - I think the OUT data set is a mistake, your code should have been OUT.FOX to create the fox data set in the OUT library. Right now it's in the work library which is not permanent and your sort or any work on the FOX data set will not be saved.

SASRB
Obsidian | Level 7

You must be right.

Upon changing "data out Fox;" to "data out.Fox;" and "proc sort data=fox;" to "proc sort data=out.fox;", there was only one table and it has appeared in the Library Pane.

I hope that`s fine now.

SASRB_0-1657123628649.png

1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 72         
 73         libname out "/home/u61696289/EPG1V2/output/Fox";
 NOTE: Libref OUT was successfully assigned as follows: 
       Engine:        V9 
       Physical Name: /home/u61696289/EPG1V2/output/Fox
 74         data out.Fox;
 75         set pg1.np_species;
 76         where Category='Mammal' and upcase(Common_Names) like '%FOX%'
 77         and upcase(Common_Names) not like '%SQUIRREL%';
 78         drop Category Record_Status Occurrence Nativeness;
 79         run;
 
 NOTE: There were 18 observations read from the data set PG1.NP_SPECIES.
       WHERE (Category='Mammal') and UPCASE(Common_Names) like '%FOX%' and UPCASE(Common_Names) not like '%SQUIRREL%';
 NOTE: The data set OUT.FOX has 18 observations and 7 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.01 seconds
       user cpu time       0.01 seconds
       system cpu time     0.00 seconds
       memory              2319.12k
       OS Memory           30636.00k
       Timestamp           06.07.2022 04:04:27 пп
       Step Count                        182  Switch Count  1
       Page Faults                       0
       Page Reclaims                     382
       Page Swaps                        0
       Voluntary Context Switches        19
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           264
       
 
 80         proc sort data=out.fox;
 81         by Common_Names;
 82         run;
 
 NOTE: There were 18 observations read from the data set OUT.FOX.
 NOTE: The data set OUT.FOX has 18 observations and 7 variables.
 NOTE: PROCEDURE SORT used (Total process time):
       real time           0.02 seconds
       user cpu time       0.00 seconds
       system cpu time     0.01 seconds
       memory              916.53k
       OS Memory           29868.00k
       Timestamp           06.07.2022 04:04:27 пп
       Step Count                        183  Switch Count  1
       Page Faults                       0
       Page Reclaims                     115
       Page Swaps                        0
       Voluntary Context Switches        45
       Involuntary Context Switches      0
       Block Input Operations            288
       Block Output Operations           264
       
 
 83         
 84         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 96         
 User: u61696289

Thank you.

 

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!

LIBNAME 101

Follow along as SAS technical trainer Dominique Weatherspoon expertly answers all your questions about SAS Libraries.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 1143 views
  • 2 likes
  • 2 in conversation