• Community
    • Home
    • Welcome
      • Getting Started
      • Community Memo
      • All Things Community
      • SAS Customer Recognition Awards (2024)
      • SAS Customer Recognition Awards (2023)
    • SAS Community Library
    • SAS Product Suggestions
    • Upcoming Events
    • SAS Customer Recognition Awards
    • All Recent Topics
  • Learn
    • New SAS User
    • SAS Software for Learning Community
    • Ask the Expert
    • SAS Certification
    • SAS Tips from the Community
    • SAS Training
      • Programming 1 and 2
      • Advanced Programming
      • Course Case Studies and Challenges
      • Trustworthy AI
    • SAS Global Forum Proceedings 2021
    • Tech Report Archive
    • SAS Insights Archive
  • Programming
    • SAS Programming
    • SAS Procedures
    • SAS Enterprise Guide
    • SAS Studio
    • Graphics Programming
    • ODS and Base Reporting
    • SAS Code Examples
    • SAS Web Report Studio
    • Developers
  • Analytics
    • Statistical Procedures
    • SAS Data Science
    • Mathematical Optimization, Discrete-Event Simulation, and OR
    • SAS/IML Software and Matrix Computations
    • SAS Forecasting and Econometrics
    • Streaming Analytics
    • Research and Science from SAS
  • SAS Viya
    • SAS Viya
    • SAS Viya on Microsoft Azure
    • SAS Viya Release Updates
    • Moving to SAS Viya
    • SAS Visual Analytics
    • SAS Visual Analytics Gallery
    • Your Journey to Success
    • SAS Viya Workbench
      • SAS Viya Workbench: Getting Started
      • SAS Viya Workbench Discussion
      • SAS Viya Workbench: Release Updates
  • Administration
    • Administration and Deployment
    • Architecture
    • SAS Hot Fix Announcements
    • SUGA
  • Solutions
    • Microsoft Integration with SAS
    • Decisioning
    • SAS Decision Builder
    • Data Management
    • Customer Intelligence
      • SAS Customer Intelligence
      • SAS Customer Intelligence 360 Release Notes
      • SAS 360 Match
    • Risk and Fraud
      • SAS Risk Management
      • Fraud, AML and Security Intelligence
      • SAS Risk Release Updates
      • Risk & Finance Analytics
      • Insurance Fraud
      • MRM AI Governance Working Group
      • SAS Quant Community
    • SAS Health
      • SAS Health and Life Sciences
      • SAS Life Science Analytics Framework
  • Hubs
    • Regional Hubs
      • SAS User Groups
      • SAS Community Nordic
      • AML Nordic User Group
      • SAS Japan
      • SAS Korea
      • CoDe SAS German
      • SAS Plattform Netzwerk
      • SAS Brazil Community
      • SAS Spanish Community
      • SAS Users Group in Israel
      • 欢迎来到SAS中文社区!
      • Ottawa Area SAS Users' Society
      • Toronto Area SAS Users Group
      • SAS Türkiye Community
    • Special Interest Hubs
      • SAS Hacker's Hub
      • SAS Innovate 2025
      • SAS Analytics Explorers
      • The Curiosity Cup
      • SAS Inner Circle Panel
      • SAS Hackathon Team Profiles (Past)
      • SAS Explore
      • Reporting and Optimization
      • Intern Alumni Network Community
Sign In

Search the Community

Showing results for 
Search instead for 
Did you mean: 
Search Options
  • Subscribe to RSS Feed for this Search
Advanced Hide Advanced
  • Posts
  • Users
  • Places
  • Products
Advanced Search Options
Search Modifiers:
You can apply modifiers to the terms you enter in the search field.
Use quotes to search for an "exact phrase".
Use the plus sign to search for +one +or +more +words.
Use the minus sign to -exclude -certain -words from your search.
Limits search results to topics that have no replies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
335 results
Sorted by:
Best Match
  • Date
  • Views
  • Likes
  • Replies
  • Best Match

Wide to Long

by Onyx | Level 15 Ronein in SAS Programming
‎05-23-2024 06:12 AM
‎05-23-2024 06:12 AM
Hello Let's say that I want to create a data set based on sas_help.class data set. The new data set will have only 2 columns:  Var_name  , Var_Value What is the way to do it? I e...
Show results in replies (3)
  • Is this really a situation where it is a good idea to convert wide to long? Is this really even a...
  • ...an you offer other way to calculate it using the original wide structure  and not convert to long...
  • ...NUMERIC_ */ do i=1 to dim(vn); Var_Name = vname(vn(i)); Var_Value = vn(i); output; end; d...

tranpose wide to long

by Lapis Lazuli | Level 10 somebody in SAS Programming
‎05-06-2020 07:58 AM
‎05-06-2020 07:58 AM
I have a dataset of fund holdings as attached. It is currently in a wide format. I would like to change it to a long format where there is one date column and one number_of_share column. Attached i...
wide_to_long.csv (‏376 KB)
Show results in replies (1)
  • You have invalid SAS names in that CSV (numeric), which my University Edition dutifully changed to...

Wide to Long

by Onyx | Level 15 Ronein in SAS Programming
‎09-11-2021 03:59 AM
‎09-11-2021 03:59 AM
Hello What are the ways to restructure the data from wide to long structure. Is it possible to use function VNAME here? IF we use proc transose then is it essential to perform 2 proc tranpose o...
Show results in replies (1)
  • @Kurt_Bremser's approach is best. Here is code for how to do it. proc transpose data=have out=h...

Wide to Long for numeric VARS only

by Onyx | Level 15 Ronein in SAS Programming
‎05-23-2024 07:23 AM
‎05-23-2024 07:23 AM
Hello With continue to previous post, I want to create a new data set based on sashelp.class data set . I want that in new data set will have 2 columns; Var_name ,Var_value. I want it to be d...
Show results in replies (1)
  • NOTE: Variable i is uninitialized. You can't use a variable named I until it has been defined and...

Wide to long

by Pyrite | Level 9 Barkat in New SAS User
‎12-07-2021 10:36 PM
‎12-07-2021 10:36 PM
I have created a data set (have) using following code. Code may not work properly. The print shows as table-1 below. I would like to make the dataset wide, so it shows like table-2.  data h...
Show results in replies (1)
  • ...est2_result test3_result; run; Untested   Transposing data tutorials: Wide to Long: https://s...

reverse transpose -wide to long

by Pyrite | Level 9 jenim514 in SAS Programming
‎04-13-2018 03:12 PM
‎04-13-2018 03:12 PM
Hi!  I need some help with a reverse transpose or bring wide to long.   i have data like this:   NUM GR3 GR4 GR5 1 0 1 0 2 1 0 0 3 0...
Show results in replies (1)
  • data have; input NUM GR3 GR4 GR5; datalines; 1 0 1 0 2 1 0 0 3 0 0 1 ; proc transpose data=have ou...

SAS transpose multiple variables wide to long

by Calcite | Level 5 darkmoon178 in SAS Programming
‎10-06-2018 05:28 PM
1 Like
‎10-06-2018 05:28 PM
1 Like
Hi everyone, I'm new with SAS and I am trying to transpose multiple variable from wide to long, as in the example mention below The A,B,C is the prefix followed by time (year).   ID  &n...
Show results in replies (1)
  • Hi @darkmoon178, seems your 1st post, so welcome to the sas forum.   First off, B...

Wide to long format

by Calcite | Level 5 Kjeldsen89 in SAS Programming
‎09-10-2021 07:30 AM
‎09-10-2021 07:30 AM
Hi everyone,  Is there a easy way to transpost my wide data into long format?   It's a pretty simple dataset which looks like this;   ID_mom        ID_child&n...
Show results in replies (1)
  • Try this   Edited to not include Year variable.   data have; input ID_mom I...

Wide to Long

by Obsidian | Level 7 PeterBr in SAS Programming
‎07-01-2020 10:59 AM
‎07-01-2020 10:59 AM
Hi All, I have a dataset below that I would like to transpose from wide to long format. I've always struggled with getting proc transpose to do what I envision but thinking that proc transpose c...
Show results in replies (1)
  • ...nalogous to your problem and ought to work.

Wide to Long Dataset

by Obsidian | Level 7 JJ_83 in New SAS User
‎03-24-2021 11:36 AM
‎03-24-2021 11:36 AM
I have this wide dataset structure.  data have; input ID 7. CO2 Methane N2O HFC; datalines; 1004377 54 28 54 30 1000112 88 40 72 1 ; And I want this long dataset structure.  d...
Show results in replies (2)
  • Transposing data tutorials: Wide to Long: https://stats.idre.ucla.edu/sas/modules/how-to-r...
  • proc transpose data=have out=want (rename=(_name_=substance col1=amount)); by id notsorted; run;
  • « Previous
    • 1
    • 2
    • 3
  • Next »
Powered by Khoros