I'm going to open up my Enterprise Guide 8 demo 1 SAS program by selecting it and then clicking Open. So here's my SAS program. And probably the first thing you notice is that my code is on the left-hand side. And then my log tab is on the right-hand side. Now these sub-tabs, just like my tabs and the panes, can be moved around freely. You can drag them around to wherever you'd like. But if you want a certain layout for all your SAS programs, what you can do is go to View and select Program Tab Presets. Now right now we've got that one-to-one vertical split.


But I'm going to change this to Standard. And that way, the Code tab, and the Log tab are now together. With that, let's actually go ahead and run this program. To run the program, I can click on Run. Or you can use the F3 key on your keyboard. But I'm going to click on Run. The program executes. And now we have a Results and Output Data tab. But by default, we see the Results tab have has opened up. With the results, you'll notice that the default output format is HTML. And if you'd like to zoom in on the results here, you can go ahead and hold down your control key and scroll up on your mouse. That'll make it a little bit easier to see the results. Next, let's go ahead and look at the Output Data tab, so I'll click Output Data. I simply made a copy of that Class table. So I Hugh I see that represented here. And I want to show you one cool thing that you can do here. Let's say I'd like to open this table up in Excel. A really quick way to do this is to right-click the name of the table, which I call it class metric, select Share, and then send it to Microsoft Excel


This is going to go ahead and send that data over to Microsoft Excel. And after a couple of seconds, here we go. I have that same exact data now over in Excel. And I could go ahead and save this file or make further modifications to it from within Excel. I'm going to go ahead and close this without saving it. But just know that that feature is available. Let's go ahead and take a look at the last tab, which is the Log tab. The Log tab is how we see messages returned back from SAS. And at the top, we have our log summary. And this is just a really quick way to see any errors, warnings, or notes that might have been returned from SAS. So that was a really quick look at the interface.


Now that we know how to navigate through to the SAS Enterprise Guide interface, let's go ahead and start talking about some of those point-and-click tasks. The first one I'd like to show you is a querying tool called the query builder. And the query builder allows us to manipulate our data. In this demonstration, I'll show you how we can use a query builder to subset our rows and columns, create new columns, and filter and sort our rows. Now to use the query builder or other point-and-click tasks and wizards, a project is required. So I'm going to start by creating a new project. I'll go to File, New, and then select Project. Now you'll notice that as soon as I created a project, a process flow was automatically created. Now to help explain this, I'm going to back up one step. I like to think of my projects as the entire story that I'm trying to tell. Because, remember, if you're working on this concept of a project, all the files that you open and work with getting saved in that single .egp Enterprise Guide project file.


Now within projects or within your story, you tend to have chapters. And that's what process flows are. They help us break up and organize all the work that we're doing inside of our Enterprise Guide project. In addition, as we start adding files to our project and we start writing tasks and programs, you actually see those items represented in the process flow. And you'll even see the relationship among the items as well. We'll see that in just a little a bit. So that's a little bit about projects and process flows. Let's actually take a look at the query builder now. I'm going to start by adding some data to my project. So I'm going to use the Servers pane. I'll expand Servers, my local server name libraries. And from the SAS Help Library, I'd like to work with the cars table.


Before I open this up, on a little side note here, if I right-click on cars, you'll notice a default behavior, which is bolded, is to open and add the table to the project. Meaning, if I right-click on cars in the Servers pane, it will physically open up the file for me to view in the work area, and the cars table will automatically be added to my project. But that's not the only option you have. When I right-click, I can also choose to just open the file, meaning open the table for me to view but don't add it to my project. Or I can choose to Add to Project, which adds the file to the project but will not open it up for me to view by default. So again, you have some options here. If you want to change the default behavior, just to show you where that is. You can go to Tools, Options. And then in the Options window, you'll select Project and Process Flows.


You can clear this option that says, when an item is open, automatically add to the project, meaning that if you open up a file, it will no longer be automatically added to the project. You'll manually have to add items you want to your project. I'm going to stick with the default behavior. So I'll go ahead and click Cancel. But I just wanted to show you that option exists. All right back, into Servers pane, I'll double click on cars. And again, that opens up the table for me to view and it adds the cars table to my project, specifically to the active process flow. Because I only have one, it's going to get added to that single process flow. Now with this example, what I'd like to do is calculate the profit of sedans. So that's going to require some data manipulation. Let's go ahead and start the query builder by clicking on the Query Builder button on the Data Grid toolbar. All right, here's the query builder.


Now the first thing I like to do is give my query a more descriptive name. That's going to be the label you see within your project and process flows, and also change the output table name as well. So for the query name, I'll go ahead and delete the default name and call it cars profit query. And then I'll click Change and change the output table name. Let's call it cars_profit. And I'll go ahead and click Save. Now on the left-hand side, you'll see that I have all the columns from the cars table listed. And if I want to see any of these columns in my output table, cars_profit, I need to include them on this Select Data tab. And there are several ways you can do this. First, let's say I want to add a range of columns.


So I want to add everything from making all the way down to invoice. To do that, I can select Make, hold down my Shift key, select Invoice, and then drag all of those columns onto the Select Data tab. It can also pick and choose individual columns. So for example, I can simply double-click on MPG city, or I can drag MPG highway as another example onto the Select Data tab. You can even use your Control key to select multiple columns and bring them onto the Select Data tab as well.

Post a Comment

If you require any additional clarification, please contact me.

Previous Post Next Post