SAS Code Help

Reply
New Contributor
Posts: 3

SAS Code Help

I'm trying to import my assignment data which is a cvs file into the sas system and am having some trouble figuring out the code. I also need to make charts and tables from this data that I bring in (pie chart, line frequency, scatter chart, area chart). Would anyone be able to assist me with the coding for this?

 

Super User
Posts: 23,323

Re: SAS Code Help

We're happy to help, but you need to provide more details.Show what you have, what you need AND what you've tried so far. 

 

Here's a starter for your, a bunch of videos that cover various topics, including how to import a CSV file. 

 

http://video.sas.com/#category/videos/how-to-tutorials

 

 

New Contributor
Posts: 3

Re: SAS Code Help

I want to produce something similar to the attachments i have provided. What would be the syntax for producing these? I can't seem to find help regarding how to code these anywhere. 

Super User
Posts: 23,323

Re: SAS Code Help

PROC SGPLOT

Super User
Posts: 13,338

Re: SAS Code Help

Unless your CSV file has some non-standard features you should be able to import it using a wizard in the File>import data menu.

 

Or if you have written code then show the code you have tried and log results and explain what you are having problems with.

 

Your online help, opened with F1 key most likely, should have a section on "learning to use SAS" with a number of examples.

 

You may have to explain exactly what you mean by "line frequency" or "area" chart (there are a number of these). The documentation for Proc SGPLOT will have examples for most common types of charts.

 

This site works best for those that show what they have attempted and let us know what isn't going well for them. If there are errors the post the code and errors from the log into a code box opened with the forum {I} menu icon.

If get stuck with an option, show the code.

 

PROC Star
Posts: 2,319

Re: SAS Code Help

Every single question here could have the title you used. Next time please make the title as specific as you can.

New Contributor
Posts: 3

Re: SAS Code Help

K!
Occasional Contributor
Posts: 15

Re: SAS Code Help

Hello , 


Don't worry it's not that hard but you have to familiar with ODS graphs/ PROC SGPLOT /PROC TEMPLATE that may helps you a lot for it.I usually do one thing If I come across CSV file than I first convert in to XLSX file ( I am just doing because I've created MACRO for it). Use try this code : 

 

1) CSV to excel : Open your csv file and hit on SAVE AS .. and save to YYYY.XLSX extension. 

2) SAS proc import code : 

Proc Import datafile=" Path / YYYY.Xlsx "  DBMS= xlsx  OUT= work.import 
 replace ;
run;

 3) depending on the variables  and requirements use PROC SGPLOT /PROC TEMPLATE ... 

 

 

I hope this may help.

 

Parth Shah 

 

PS
Regular Contributor
Posts: 202

Re: SAS Code Help

@shahparth260: "I usually do one thing If I come across CSV file than I first convert in to XLSX file".

This is by far the worst thing you can do with a csv-file. Proc import is a guessing procedure, it assumes variable types an length and can fail to import a file that could be read by a data step. Additionally excel tends to modify data without notifying the user, so almost always additional steps are necessary to fix things gone wrong. And things will sooner or later go wrong.
Ask a Question
Discussion stats
  • 8 replies
  • 294 views
  • 2 likes
  • 6 in conversation