BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
1 ACCEPTED SOLUTION

Accepted Solutions
yabwon
Amethyst | Level 16
data old(compress=char);
  set old;
run;
_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



View solution in original post

8 REPLIES 8
Prashanth10
Calcite | Level 5
But yabwon.. but compress would create a new output sas datset. But i dont want to create a new datset. Is there any other way?
yabwon
Amethyst | Level 16
data old(compress=char);
  set old;
run;
_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



Prashanth10
Calcite | Level 5
Thanks ksharp..but this method will create a new dataset. But i dont want to create a new dataset. Is there any other way?
Tom
Super User Tom
Super User

Please provide more context on what you are doing. 

I find that compressing SAS datasets with ZIP or GZIP will reduce the file size a lot (up to 80-90 percent reduction on many cases).  But then you will need to uncompress them to use them.

yabwon
Amethyst | Level 16

@Tom 

Just a side note.

With the current SAS (9.4M2 and newer) you don't need any external ZIPping software.

 

The following code makes 128KB file into 2KB zip.

data class; /* demo dataset */
  set sashelp.class;
run;

filename cmprss ZIP "%sysfunc(pathname(work))/class.zip" member="class.sas7bdat" lrecl = 1 recfm = f;

filename in "%sysfunc(pathname(work))/class.sas7bdat" lrecl = 1 recfm = f;

data _null_;
  rc = fcopy("in", "cmprss");
  put rc = ;
run;

and the following one will unzip it back:

data _null_;
  rc = fcopy("cmprss", "in");
  put rc = ;
run;

All the best

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 8 replies
  • 1638 views
  • 0 likes
  • 5 in conversation