BookmarkSubscribeRSS Feed
Jprathap447
Calcite | Level 5

I have a data with some remarks field as common, I want to know the count of that data and the sum

13 REPLIES 13
Kurt_Bremser
Super User

Hi and welcome to the communities!

 

Please give us an example for your dataset, ideally in a data step with datalines (so we can easily recreate it for testing).

Use the "little running man" button (right next to the one indicated) to post your code:

Bildschirmfoto 2020-04-07 um 08.32.59.jpg

The one indicated is best for logs and text data (e.g. from CSV files).

 

And show us what you expect as a result. If you already tried code to solve your issue, post that also.

Jprathap447
Calcite | Level 5

I want to know how many C type of apples and the count and sum of the amount... etc

Kurt_Bremser
Super User

Do you think of something like this:

data have;
infile '/folders/myfolders/datasas.csv' dlm=',' dsd truncover;
input date :mmddyy10. amount name $ type :$1.;
format date yymmddd10.;
run;

proc sql;
create table want as
  select
    name,
    type,
    count(name) as count,
    sum(amount) as amount
  from have
  group by name, type
;
quit;
Jprathap447
Calcite | Level 5

Q1. I am using windows 10 and the datasas file is on my desktop "C:\Users\prathap\Desktop"; how to map it

 

Kurt_Bremser
Super User

Do you have a licensed SAS installation, or University Edition?

If licensed, locally on your desktop or on a server?

If server, do you use SAS Studio or Enterprise Guide?

Jprathap447
Calcite | Level 5
Licensed SAS installation, on Server, using Enterprise Guide.
Jprathap447
Calcite | Level 5
It is not showing .csv file, it is accepting only SAS database files while browsing to upload file to server.
Jprathap447
Calcite | Level 5
I am using 4.3. Thanks for your support.
Kurt_Bremser
Super User

If you like to live in the past, why do you use Windows 10 instead of XP, which is about as old?

 

Really, you should update to 7.15 or 8.2 ASAP, you're missing out on a tankerload of features.

And the current version is always included in SAS licenses.

 

Read the blog article, @ChrisHemedinger also provides the task as an add-on to earlier EG versions.

 

Without the task, you can always use a SFTP client to upload data to your SAS server, or use a shared network resource that is available both on your desktop and server. In the end, the file has to be "visible" to your SAS session, so you can run my code.

 

You can also use the import wizard of EG, but you need to supply the column names, types and formats yourself, since your csv file does not have a header line.

 

Jprathap447
Calcite | Level 5
can I write steps like using query builder...
ChrisHemedinger
Community Manager

Hi @Jprathap447 -

 

Welcome to the community and to the world of SAS.  The version of SAS Enterprise Guide that you're using is quite old, but you still might benefit from this tutorial.  It's 2+ hours and covers what you need to know about working within the environment, and completing basic tasks like querying and summarizing data.

 

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 13 replies
  • 1673 views
  • 2 likes
  • 3 in conversation