BookmarkSubscribeRSS Feed
Sukh44
Calcite | Level 5

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?

 

8 REPLIES 8
Reeza
Super User

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

 

 

Sukh44
Calcite | Level 5

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. 

Reeza
Super User

PROC SGPLOT

ballardw
Super User

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.

 

ChrisNZ
Tourmaline | Level 20

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

Sukh44
Calcite | Level 5
K!
shahparth260
Quartz | Level 8

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
error_prone
Barite | Level 11
@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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 8 replies
  • 1117 views
  • 2 likes
  • 6 in conversation